diff --git a/Gruntfile.js b/Gruntfile.js index 758fe134..09b7192c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -11,7 +11,7 @@ module.exports = function (grunt) { compile_dir: 'dist', src: { phaser: [ - 'build/p2.js', + 'build/p2.js', 'src/Intro.js', 'src/pixi/Pixi.js', 'src/Phaser.js', diff --git a/README.md b/README.md index 48a08f58..e80a93e1 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ Significant API changes: * BitmapText has had a bit of an overhaul - the signature for adding a BitmapText has changed to: x, y, font, text, size. See the docs and examples for details. * World preUpdate, update and postUpdate have all been moved to Stage. So all children are updated regardless where on the display list they live. * Cache.getImageKeys and similar has been removed, please use Cache.getKeys(Phaser.Cache.IMAGE) instead, this now supports all 10 Cache data types. +* After defining tiles that collide on a Tilemap, you need to call Tilemap.generateCollisionData(layer) to populate the physics world with the data required. New features: @@ -117,6 +118,7 @@ New features: * Cache.addPhysicsData and Cache.getPhysicsData allow you to store parsed JSON physics data in the cache, for sharing between Bodies. * fixedToCamera now works across all display objects. When enabled it will fix at its current x/y coordinate, but can be changed via cameraOffset. * fixedToCamrea now works for Groups as well :) You can fix a Group to the camera and it will influence its children. +* Tilemap.createCollisionObjects will parse Tiled data for objectgroups and convert polyline instances into physics objects you can collide with in the world. Updates: diff --git a/build/p2.js b/build/p2.js index 509e018d..b862ac0e 100644 --- a/build/p2.js +++ b/build/p2.js @@ -1068,7 +1068,6 @@ Polygon.prototype.getCutEdges = function() { */ Polygon.prototype.decomp = function(){ var edges = this.getCutEdges(); - console.log('decomp', edges); if(edges.length > 0) return this.slice(edges); else @@ -1921,6 +1920,12 @@ function Narrowphase(){ */ this.frictionCoefficient = 0.3; + /** + * Will be the .relativeVelocity in each produced FrictionEquation. + * @property {Number} surfaceVelocity + */ + this.surfaceVelocity = 0; + this.reuseObjects = true; this.reusableContactEquations = []; this.reusableFrictionEquations = []; @@ -1974,36 +1979,6 @@ function clearObject(obj){ */ Narrowphase.prototype.reset = function(world){ - // Emit world separation event - if(world && world.emitSeparationEvent){ - for(var i=0; i=0;j--) { + if(a[j].aabb.lowerBound[0] <= v.aabb.lowerBound[0]) + break; + a[j+1] = a[j]; + } + a[j+1] = v; + } + return a; }; /** - * Function for sorting bodies along the Y axis. To be passed to array.sort() + * Sorts bodies along the Y axis. * @method sortAxisListY - * @param {Body} bodyA - * @param {Body} bodyB - * @return {Number} + * @param {Array} a + * @return {Array} */ -SAP1DBroadphase.sortAxisListY = function(bodyA,bodyB){ - return (bodyA.position[1]-bodyA.boundingRadius) - (bodyB.position[1]-bodyB.boundingRadius); +SAPBroadphase.sortAxisListY = function(a){ + for(var i=1,l=a.length;i=0;j--) { + if(a[j].aabb.lowerBound[1] <= v.aabb.lowerBound[1]) + break; + a[j+1] = a[j]; + } + a[j+1] = v; + } + return a; }; +var preliminaryList = { keys:[] }; + /** * Get the colliding pairs * @method getCollisionPairs * @param {World} world * @return {Array} */ -SAP1DBroadphase.prototype.getCollisionPairs = function(world){ - var bodies = this.axisList, +SAPBroadphase.prototype.getCollisionPairs = function(world){ + var bodiesX = this.axisListX, + bodiesY = this.axisListY, result = this.result, axisIndex = this.axisIndex, i,j; result.length = 0; - // Sort the list - bodies.sort(axisIndex === 0 ? SAP1DBroadphase.sortAxisListX : SAP1DBroadphase.sortAxisListY ); + // Update all AABBs if needed + for(i=0; i!==bodiesX.length; i++){ + var b = bodiesX[i]; + if(b.aabbNeedsUpdate) b.updateAABB(); + } - // Look through the list - for(i=0, N=bodies.length; i!==N; i++){ - var bi = bodies[i]; + // Sort the lists + SAPBroadphase.sortAxisListX(bodiesX); + SAPBroadphase.sortAxisListY(bodiesY); + + // Look through the X list + for(i=0, N=bodiesX.length; i!==N; i++){ + var bi = bodiesX[i]; for(j=i+1; j 0; np.frictionCoefficient = mu; np.restitution = restitution; + np.surfaceVelocity = surfaceVelocity; var resolver = np[si.type | sj.type], numContacts = 0; @@ -9519,31 +9545,43 @@ World.prototype.runNarrowphase = function(np,bi,si,xi,ai,bj,sj,xj,aj,mu,restitut numContacts = resolver.call(np, bj,sj,xjw,ajw, bi,si,xiw,aiw); } - if(numContacts > 0){ + if(numContacts){ var key = si.id < sj.id ? si.id+" "+ sj.id : sj.id+" "+ si.id; if(!this.overlappingShapesLastState[key]){ + // Report new shape overlap var e = this.beginContactEvent; e.shapeA = si; e.shapeB = sj; e.bodyA = bi; e.bodyB = bj; - this.emit(e); - var current = this.overlappingShapesCurrentState; - if(!current[key]){ - current[key] = true; - current.keys.push(key); - // Also store shape & body data - current[key+"_shapeA"] = si; - current.keys.push(key+"_shapeA"); - current[key+"_shapeB"] = sj; - current.keys.push(key+"_shapeB"); - current[key+"_bodyA"] = bi; - current.keys.push(key+"_bodyA"); - current[key+"_bodyB"] = bj; - current.keys.push(key+"_bodyB"); + if(typeof(numContacts)=="number"){ + // Add contacts to the event object + e.contactEquations.length = 0; + for(var i=np.contactEquations.length-numContacts; i=0;j--) { + if(a[j].aabb.lowerBound[0] <= v.aabb.lowerBound[0]) + break; + a[j+1] = a[j]; + } + a[j+1] = v; + } + return a; }; /** - * Function for sorting bodies along the Y axis. To be passed to array.sort() + * Sorts bodies along the Y axis. * @method sortAxisListY - * @param {Body} bodyA - * @param {Body} bodyB - * @return {Number} + * @param {Array} a + * @return {Array} */ -SAP1DBroadphase.sortAxisListY = function(bodyA,bodyB){ - return (bodyA.position[1]-bodyA.boundingRadius) - (bodyB.position[1]-bodyB.boundingRadius); +SAPBroadphase.sortAxisListY = function(a){ + for(var i=1,l=a.length;i=0;j--) { + if(a[j].aabb.lowerBound[1] <= v.aabb.lowerBound[1]) + break; + a[j+1] = a[j]; + } + a[j+1] = v; + } + return a; }; +var preliminaryList = { keys:[] }; + /** * Get the colliding pairs * @method getCollisionPairs * @param {World} world * @return {Array} */ -SAP1DBroadphase.prototype.getCollisionPairs = function(world){ - var bodies = this.axisList, +SAPBroadphase.prototype.getCollisionPairs = function(world){ + var bodiesX = this.axisListX, + bodiesY = this.axisListY, result = this.result, axisIndex = this.axisIndex, i,j; result.length = 0; - // Sort the list - bodies.sort(axisIndex === 0 ? SAP1DBroadphase.sortAxisListX : SAP1DBroadphase.sortAxisListY ); + // Update all AABBs if needed + for(i=0; i!==bodiesX.length; i++){ + var b = bodiesX[i]; + if(b.aabbNeedsUpdate) b.updateAABB(); + } - // Look through the list - for(i=0, N=bodies.length; i!==N; i++){ - var bi = bodies[i]; + // Sort the lists + SAPBroadphase.sortAxisListX(bodiesX); + SAPBroadphase.sortAxisListY(bodiesY); + + // Look through the X list + for(i=0, N=bodiesX.length; i!==N; i++){ + var bi = bodiesX[i]; for(j=i+1; j 0; np.frictionCoefficient = mu; np.restitution = restitution; + np.surfaceVelocity = surfaceVelocity; var resolver = np[si.type | sj.type], numContacts = 0; @@ -9527,31 +9554,43 @@ World.prototype.runNarrowphase = function(np,bi,si,xi,ai,bj,sj,xj,aj,mu,restitut numContacts = resolver.call(np, bj,sj,xjw,ajw, bi,si,xiw,aiw); } - if(numContacts > 0){ + if(numContacts){ var key = si.id < sj.id ? si.id+" "+ sj.id : sj.id+" "+ si.id; if(!this.overlappingShapesLastState[key]){ + // Report new shape overlap var e = this.beginContactEvent; e.shapeA = si; e.shapeB = sj; e.bodyA = bi; e.bodyB = bj; - this.emit(e); - var current = this.overlappingShapesCurrentState; - if(!current[key]){ - current[key] = true; - current.keys.push(key); - // Also store shape & body data - current[key+"_shapeA"] = si; - current.keys.push(key+"_shapeA"); - current[key+"_shapeB"] = sj; - current.keys.push(key+"_shapeB"); - current[key+"_bodyA"] = bi; - current.keys.push(key+"_bodyA"); - current[key+"_bodyB"] = bj; - current.keys.push(key+"_bodyB"); + if(typeof(numContacts)=="number"){ + // Add contacts to the event object + e.contactEquations.length = 0; + for(var i=np.contactEquations.length-numContacts; i= this.size) + if(texture.baseTexture !== this.currentBaseTexture || this.currentBatchSize >= this.size) { this.flush(); - this.currentBaseTexture = sprite.texture.baseTexture; + this.currentBaseTexture = texture.baseTexture; } @@ -17866,8 +18027,6 @@ PIXI.WebGLSpriteBatch.prototype.render = function(sprite) var verticies = this.vertices; - var width = sprite.texture.frame.width; - var height = sprite.texture.frame.height; // TODO trim?? var aX = sprite.anchor.x; @@ -17881,18 +18040,19 @@ PIXI.WebGLSpriteBatch.prototype.render = function(sprite) var trim = sprite.texture.trim; w1 = trim.x - aX * trim.width; - w0 = w1 + width; + w0 = w1 + texture.frame.width; h1 = trim.y - aY * trim.height; - h0 = h1 + height; + h0 = h1 + texture.frame.height; + } else { - w0 = (width ) * (1-aX); - w1 = (width ) * -aX; + w0 = (texture.frame.width ) * (1-aX); + w1 = (texture.frame.width ) * -aX; - h0 = height * (1-aY); - h1 = height * -aY; + h0 = texture.frame.height * (1-aY); + h1 = texture.frame.height * -aY; } var index = this.currentBatchSize * 4 * this.vertSize; @@ -18595,7 +18755,7 @@ PIXI.WebGLFilterManager.prototype.begin = function(renderSession, buffer) this.defaultShader = renderSession.shaderManager.defaultShader; var projection = this.renderSession.projection; - + // console.log(this.width) this.width = projection.x * 2; this.height = -projection.y * 2; this.buffer = buffer; @@ -18721,6 +18881,7 @@ PIXI.WebGLFilterManager.prototype.popFilter = function() var inputTexture = texture; var outputTexture = this.texturePool.pop(); if(!outputTexture)outputTexture = new PIXI.FilterTexture(this.gl, this.width, this.height); + outputTexture.resize(this.width, this.height); // need to clear this FBO as it may have some left over elements from a previous filter. gl.bindFramebuffer(gl.FRAMEBUFFER, outputTexture.frameBuffer ); @@ -18771,7 +18932,7 @@ PIXI.WebGLFilterManager.prototype.popFilter = function() // time to render the filters texture to the previous scene if(this.filterStack.length === 0) { - gl.colorMask(true, true, true, this.transparent); + gl.colorMask(true, true, true, true);//this.transparent); } else { @@ -18828,7 +18989,12 @@ PIXI.WebGLFilterManager.prototype.popFilter = function() gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.uvArray); + //console.log(this.vertexArray) + //console.log(this.uvArray) + //console.log(sizeX + " : " + sizeY) + gl.viewport(0, 0, sizeX, sizeY); + // bind the buffer gl.bindFramebuffer(gl.FRAMEBUFFER, buffer ); @@ -18892,6 +19058,7 @@ PIXI.WebGLFilterManager.prototype.applyFilterPass = function(filter, filterArea, filter.uniforms.dimensions.value[3] = this.vertexArray[5];//filterArea.height; } + // console.log(this.uvArray ) shader.syncUniforms(); gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer); @@ -18997,6 +19164,7 @@ PIXI.WebGLFilterManager.prototype.destroy = function() gl.deleteBuffer(this.colorBuffer); gl.deleteBuffer(this.indexBuffer); }; + /** * @author Mat Groves http://matgroves.com/ @Doormat23 */ @@ -21200,6 +21368,12 @@ PIXI.BaseTexture = function(source, scaleMode) */ this.source = source; + //TODO will be used for futer pixi 1.5... + this.id = PIXI.BaseTextureCacheIdGenerator++; + + // used for webGL + this._glTextures = []; + if(!source)return; if(this.source.complete || this.source.getContext) @@ -21229,11 +21403,7 @@ PIXI.BaseTexture = function(source, scaleMode) this.imageUrl = null; this._powerOf2 = false; - //TODO will be used for futer pixi 1.5... - this.id = PIXI.BaseTextureCacheIdGenerator++; - - // used for webGL - this._glTextures = []; + }; @@ -21555,7 +21725,8 @@ PIXI.Texture.addTextureToCache = function(texture, id) PIXI.Texture.removeTextureFromCache = function(id) { var texture = PIXI.TextureCache[id]; - PIXI.TextureCache[id] = null; + delete PIXI.TextureCache[id]; + delete PIXI.BaseTextureCache[id]; return texture; }; @@ -21769,6 +21940,8 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, position, cl { var children = displayObject.children; + var originalWorldTransform = displayObject.worldTransform; + displayObject.worldTransform = PIXI.RenderTexture.tempMatrix; if(position) @@ -21789,9 +21962,13 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, position, cl this.renderer.renderDisplayObject(displayObject, context); context.setTransform(1,0,0,1,0,0); + + displayObject.worldTransform = originalWorldTransform; }; PIXI.RenderTexture.tempMatrix = new PIXI.Matrix(); + + /** * @author Richard Davey * @copyright 2014 Photon Storm Ltd. @@ -34016,7 +34193,7 @@ Object.defineProperty(Phaser.Sprite.prototype, "physicsEnabled", { { if (this.body === null) { - this.body = new Phaser.Physics.Body(this); + this.body = new Phaser.Physics.Body(this.game, this, this.x, this.y, 1); this.anchor.set(0.5); } } @@ -36045,8 +36222,8 @@ Object.defineProperty(Phaser.Text.prototype, "fixedToCamera", { * @classdesc BitmapText objects work by taking a texture file and an XML file that describes the font layout. * * On Windows you can use the free app BMFont: http://www.angelcode.com/products/bmfont/ -* * On OS X we recommend Glyph Designer: http://www.71squared.com/en/glyphdesigner +* For Web there is the great Littera: http://kvazars.com/littera/ * * @constructor * @param {Phaser.Game} game - A reference to the currently running game. @@ -37151,16 +37328,6 @@ Phaser.Graphics = function (game, x, y) { */ this.world = new Phaser.Point(x, y); - /** - * @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 {Phaser.InputHandler|null} input - The Input Handler for this object. Needs to be enabled with image.inputEnabled = true before you can use it. - */ - this.input = null; - /** * @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view. */ @@ -37306,42 +37473,6 @@ Object.defineProperty(Phaser.Graphics.prototype, 'angle', { }); -/** -* By default a Graphics object 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.Graphics#inputEnabled -* @property {boolean} inputEnabled - Set to true to allow this object to receive input events. -*/ -Object.defineProperty(Phaser.Graphics.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(); - } - } - } - -}); - /** * An Graphics that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Graphics.cameraOffset. * Note that the cameraOffset values are in addition to any parent in the display list. @@ -45796,6 +45927,7 @@ Phaser.AnimationParser = { PIXI.TextureCache[uuid].trim = new Phaser.Rectangle(frames[i].spriteSourceSize.x, frames[i].spriteSourceSize.y, frames[i].sourceSize.w, frames[i].sourceSize.h); } + } return data; @@ -45862,7 +45994,7 @@ Phaser.AnimationParser = { frames[key].spriteSourceSize.h ); - PIXI.TextureCache[uuid].trim = new Phaser.Rectangle(frames[i].spriteSourceSize.x, frames[i].spriteSourceSize.y, frames[i].sourceSize.w, frames[i].sourceSize.h); + PIXI.TextureCache[uuid].trim = new Phaser.Rectangle(frames[key].spriteSourceSize.x, frames[key].spriteSourceSize.y, frames[key].sourceSize.w, frames[key].sourceSize.h); } i++; @@ -50566,14 +50698,30 @@ Phaser.Utils.Debug.prototype = { this.start(0, 0, color); - var i = body.data.shapes.length; - var x = this.game.math.p2px(body.data.position[0]); - var y = this.game.math.p2px(body.data.position[1]); + var shapes = body.data.shapes; + var shapeOffsets = body.data.shapeOffsets; + var shapeAngles = body.data.shapeAngles; + + var i = shapes.length; + var x = this.game.math.p2px(body.data.position[0]) - this.game.camera.view.x; + var y = this.game.math.p2px(body.data.position[1]) - this.game.camera.view.y; var angle = body.data.angle; while (i--) { - this.renderShape(body.data.shapes[i], x, y, angle); + if (shapes[i] instanceof p2.Rectangle) + { + this.renderShapeRectangle(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]); + } + else if (shapes[i] instanceof p2.Line) + { + this.renderShapeLine(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]); + } + // else if (shapes[i] instanceof p2.Convex) + else + { + this.renderShapeConvex(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]); + } } this.stop(); @@ -50587,17 +50735,68 @@ Phaser.Utils.Debug.prototype = { * @param {number} y - The y coordinate of the Body to translate to. * @param {number} angle - The angle of the Body to rotate to. */ - renderShape: function (shape, x, y, angle) { + renderShapeRectangle: function (x, y, bodyAngle, shape, offset, angle) { var w = this.game.math.p2px(shape.width); var h = this.game.math.p2px(shape.height); var points = shape.vertices; + this.context.beginPath(); + this.context.save(); + this.context.translate(x + this.game.math.p2px(offset[0]), y + this.game.math.p2px(offset[1])); + this.context.rotate(bodyAngle + angle); + + this.context.moveTo(this.game.math.p2px(points[0][0]), this.game.math.p2px(points[0][1])); + + for (var i = 1; i < points.length; i++) + { + this.context.lineTo(this.game.math.p2px(points[i][0]), this.game.math.p2px(points[i][1])); + } + + this.context.closePath(); + this.context.stroke(); + this.context.restore(); + + }, + + /** + * @method Phaser.Utils.Debug#renderShape + * @param {number} x - The x coordinate of the Body to translate to. + * @param {number} y - The y coordinate of the Body to translate to. + * @param {p2.Shape} shape - The shape to render. + * @param {number} offset - + * @param {number} angle - + */ + renderShapeLine: function (x, y, bodyAngle, shape, offset, angle) { + this.context.beginPath(); this.context.save(); this.context.translate(x, y); - this.context.rotate(angle); + this.context.rotate(bodyAngle + angle); this.context.lineWidth = 0.5; + this.context.moveTo(0, 0); + this.context.lineTo(this.game.math.p2px(shape.length), 0); + this.context.closePath(); + this.context.stroke(); + this.context.restore(); + + }, + + /** + * @method Phaser.Utils.Debug#renderShape + * @param {p2.Shape} shape - The shape to render. + * @param {number} x - The x coordinate of the Body to translate to. + * @param {number} y - The y coordinate of the Body to translate to. + * @param {number} angle - The angle of the Body to rotate to. + */ + renderShapeConvex: function (x, y, bodyAngle, shape, offset, angle) { + + var points = shape.vertices; + + this.context.beginPath(); + this.context.save(); + this.context.translate(x + this.game.math.p2px(offset[0]), y + this.game.math.p2px(offset[1])); + this.context.rotate(bodyAngle + angle); this.context.moveTo(this.game.math.p2px(points[0][0]), this.game.math.p2px(points[0][1])); @@ -51203,6 +51402,45 @@ Phaser.Physics.World.prototype.destroy = function () { }; +/** +* @method Phaser.Physics.World.prototype.createBody +* @param {number} x - The x coordinate of Body. +* @param {number} y - The y coordinate of Body. +* @param {number} mass - The mass of the Body. A mass of 0 means a 'static' Body is created. +* @param {boolean} [addToWorld=false] - Automatically add this Body to the world? (usually false as it won't have any shapes on construction). +* @param {object} options - An object containing the build options: +* @param {boolean} [options.optimalDecomp=false] - Set to true if you need optimal decomposition. Warning: very slow for polygons with more than 10 vertices. +* @param {boolean} [options.skipSimpleCheck=false] - Set to true if you already know that the path is not intersecting itself. +* @param {boolean|number} [options.removeCollinearPoints=false] - Set to a number (angle threshold value) to remove collinear points, or false to keep all points. +* @param {(number[]|...number)} points - An array of 2d vectors that form the convex or concave polygon. +* Either [[0,0], [0,1],...] or a flat array of numbers that will be interpreted as [x,y, x,y, ...], +* or the arguments passed can be flat x,y values e.g. `setPolygon(options, x,y, x,y, x,y, ...)` where `x` and `y` are numbers. +*/ +Phaser.Physics.World.prototype.createBody = function (x, y, mass, addToWorld, options, data) { + + if (typeof addToWorld === 'undefined') { addToWorld = false; } + + var body = new Phaser.Physics.Body(this.game, null, x, y, mass); + + if (data) + { + var result = body.addPolygon(options, data); + + if (!result) + { + return false; + } + } + + if (addToWorld) + { + this.addBody(body.data); + } + + return body; + +}; + /** * @author Richard Davey * @copyright 2014 Photon Storm Ltd. @@ -51272,7 +51510,7 @@ Object.defineProperty(Phaser.Physics.PointProxy.prototype, "y", { */ /** -* The Physics Body is linked to a single Sprite and defines properties that determine how the physics body is simulated. +* The Physics Body is typically linked to a single Sprite and defines properties that determine how the physics body is simulated. * These properties affect how the body reacts to forces, what forces it generates on itself (to simulate friction), and how it reacts to collisions in the scene. * In most cases, the properties are used to simulate physical effects. Each body also has its own property values that determine exactly how it reacts to forces and collisions in the scene. * By default a single Rectangle shape is added to the Body that matches the dimensions of the parent Sprite. See addShape, removeShape, clearShapes to add extra shapes around the Body. @@ -51280,20 +51518,29 @@ Object.defineProperty(Phaser.Physics.PointProxy.prototype, "y", { * @class Phaser.Physics.Body * @classdesc Physics Body Constructor * @constructor -* @param {Phaser.Sprite} sprite - The Sprite object this physics body belongs to. +* @param {Phaser.Game} game - Game reference to the currently running game. +* @param {Phaser.Sprite} [sprite] - The Sprite object this physics body belongs to. +* @param {number} [x=0] - The x coordinate of this Body. +* @param {number} [y=0] - The y coordinate of this Body. +* @param {number} [mass=1] - The default mass of this Body (0 = static). */ -Phaser.Physics.Body = function (sprite) { +Phaser.Physics.Body = function (game, sprite, x, y, mass) { + + sprite = sprite || null; + x = x || 0; + y = y || 0; + if (typeof mass === 'undefined') { mass = 1; } + + /** + * @property {Phaser.Game} game - Local reference to game. + */ + this.game = game; /** * @property {Phaser.Sprite} sprite - Reference to the parent Sprite. */ this.sprite = sprite; - /** - * @property {Phaser.Game} game - Local reference to game. - */ - this.game = sprite.game; - /** * @property {Phaser.Point} offset - The offset of the Physics Body from the Sprite x/y position. */ @@ -51303,7 +51550,7 @@ Phaser.Physics.Body = function (sprite) { * @property {p2.Body} data - The p2 Body data. * @protected */ - this.data = new p2.Body({ position:[this.px2p(sprite.position.x), this.px2p(sprite.position.y)], mass: 1 }); + this.data = new p2.Body({ position:[this.px2p(x), this.px2p(y)], mass: mass }); this.data.parent = this; /** @@ -51320,9 +51567,11 @@ Phaser.Physics.Body = function (sprite) { // this.onRemoved = new Phaser.Signal(); // Set-up the default shape - this.setRectangleFromSprite(sprite); - - this.game.physics.addBody(this.data); + if (sprite) + { + this.setRectangleFromSprite(sprite); + this.game.physics.addBody(this.data); + } }; @@ -51478,6 +51727,23 @@ Phaser.Physics.Body.prototype = { }, + /** + * Applies a force to the Body that causes it to 'thrust' backwards (in reverse), based on its current angle and the given speed. + * The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms). + * + * @method Phaser.Physics.Body#rever + * @param {number} speed - The speed at which it should reverse. + */ + reverse: function (speed) { + + var magnitude = this.px2p(-speed); + var angle = this.data.angle + Math.PI / 2; + + this.data.force[0] -= magnitude * Math.cos(angle); + this.data.force[1] -= magnitude * Math.sin(angle); + + }, + /** * If this Body is dynamic then this will move it to the left by setting its x velocity to the given speed. * The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms). @@ -51803,14 +52069,19 @@ Phaser.Physics.Body.prototype = { // Did they pass in a single array of points? if (points.length === 1 && Array.isArray(points[0])) { - path = path.concat(points[0]); + path = points[0].slice(0); } else if (Array.isArray(points[0])) { - path = path.concat(points); + path = points[0].slice(0); + // for (var i = 0, len = points[0].length; i < len; i += 2) + // { + // path.push([points[0][i], points[0][i + 1]]); + // } } else if (typeof points[0] === 'number') { + // console.log('addPolygon --- We\'ve a list of numbers'); // We've a list of numbers for (var i = 0, len = points.length; i < len; i += 2) { @@ -51818,6 +52089,18 @@ Phaser.Physics.Body.prototype = { } } + // console.log('addPolygon PATH pre'); + // console.log(path[1]); + // console.table(path); + + // top and tail + var idx = path.length - 1; + + if ( path[idx][0] === path[0][0] && path[idx][1] === path[0][1] ) + { + path.pop(); + } + // Now process them into p2 values for (var p = 0; p < path.length; p++) { @@ -51825,6 +52108,10 @@ Phaser.Physics.Body.prototype = { path[p][1] = this.px2p(path[p][1]); } + // console.log('addPolygon PATH POST'); + // console.log(path[1]); + // console.table(path); + return this.data.fromPolygon(path, options); }, @@ -52011,10 +52298,16 @@ Object.defineProperty(Phaser.Physics.Body.prototype, "static", { if (value && this.data.motionState !== Phaser.STATIC) { this.data.motionState = Phaser.STATIC; + this.mass = 0; } else if (!value && this.data.motionState === Phaser.STATIC) { this.data.motionState = Phaser.DYNAMIC; + + if (this.mass === 0) + { + this.mass = 1; + } } } @@ -52038,10 +52331,16 @@ Object.defineProperty(Phaser.Physics.Body.prototype, "dynamic", { if (value && this.data.motionState !== Phaser.DYNAMIC) { this.data.motionState = Phaser.DYNAMIC; + + if (this.mass === 0) + { + this.mass = 1; + } } else if (!value && this.data.motionState === Phaser.DYNAMIC) { this.data.motionState = Phaser.STATIC; + this.mass = 0; } } @@ -52069,6 +52368,7 @@ Object.defineProperty(Phaser.Physics.Body.prototype, "kinematic", { else if (!value && this.data.motionState === Phaser.KINEMATIC) { this.data.motionState = Phaser.STATIC; + this.mass = 0; } } @@ -52266,6 +52566,11 @@ Object.defineProperty(Phaser.Physics.Body.prototype, "mass", { { this.data.mass = value; this.data.updateMassProperties(); + + if (value === 0) + { + // this.static = true; + } } } @@ -53557,6 +53862,11 @@ Phaser.Tilemap = function (game, key) { */ this.objects = data.objects; + /** + * @property {array} collision - An array of collision data (polylines, etc). + */ + this.collision = data.collision; + /** * @property {array} images - An array of Tiled Image Layers. */ @@ -53743,6 +54053,141 @@ Phaser.Tilemap.prototype = { }, + /** + * Clears all physics bodies from the world for the given layer. + * + * @method Phaser.Tilemap#clearPhysicsBodies + * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer. + */ + clearPhysicsBodies: function (layer) { + + layer = this.getLayer(layer); + + var i = this.layers[layer].bodies.length; + + while (i--) + { + this.layers[layer].bodies[i].destroy(); + } + + }, + + /** + * Goes through all tiles in the given layer and converts those set to collide into physics bodies in the world. + * Only call this *after* you have specified all of the tiles you wish to collide with calls like Tilemap.setCollisionBetween, etc. + * Every time you call this method it will destroy any previously created bodies and remove them from the world. + * Therefore understand it's an expensive operation and not to be done in a core game update loop. + * + * @method Phaser.Tilemap#generateCollisionData + * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer. + * @param {boolean} [addToWorld=true] - If true it will automatically add each body to the world, otherwise it's up to you to do so. + * @return {array} An array of the Phaser.Physics.Body objects that have been created. + */ + generateCollisionData: function (layer, addToWorld) { + + layer = this.getLayer(layer); + + if (typeof addToWorld === 'undefined') { addToWorld = true; } + + // If the bodies array is already populated we need to nuke it + if (this.layers[layer].bodies.length > 0) + { + this.clearPhysicsBodies(layer); + } + + this.layers[layer].bodies.length = []; + + var width = 0; + var sx = 0; + var sy = 0; + + for (var y = 0, h = this.layers[layer].height; y < h; y++) + { + width = 0; + + for (var x = 0, w = this.layers[layer].width; x < w; x++) + { + var tile = this.layers[layer].data[y][x]; + + if (tile) + { + right = this.getTileRight(layer, x, y); + + if (width === 0) + { + sx = tile.x * tile.width; + sy = tile.y * tile.height; + width = tile.width; + } + + if (right && right.collides) + { + width += tile.width; + } + else + { + var body = this.game.physics.createBody(sx, sy, 0, false); + + body.addRectangle(width, tile.height, width / 2, tile.height / 2, 0); + + if (addToWorld) + { + this.game.physics.addBody(body.data); + } + + this.layers[layer].bodies.push(body); + + width = 0; + } + } + } + } + + return this.layers[layer].bodies; + + }, + + /** + * Converts all of the polylines inside a Tiled ObjectGroup into physics bodies that are added to the world. + * Note that the polylines must be created in such a way that they can withstand polygon decomposition. + * + * @method Phaser.Tilemap#createCollisionObjects + * @param {string} [layer] - The Tiled layer to operate on that contains the collision data. + * @param {boolean} [addToWorld=true] - If true it will automatically add each body to the world. + * @return {array} An array of the Phaser.Physics.Body objects that have been created. + */ + createCollisionObjects: function (layer, addToWorld) { + + if (typeof addToWorld === 'undefined') { addToWorld = true; } + + var output = []; + + for (var i = 0, len = this.collision[layer].length; i < len; i++) + { + // name: json.layers[i].objects[v].name, + // x: json.layers[i].objects[v].x, + // y: json.layers[i].objects[v].y, + // width: json.layers[i].objects[v].width, + // height: json.layers[i].objects[v].height, + // visible: json.layers[i].objects[v].visible, + // properties: json.layers[i].objects[v].properties, + // polyline: json.layers[i].objects[v].polyline + + var object = this.collision[layer][i]; + + var body = this.game.physics.createBody(object.x, object.y, 0, addToWorld, {}, object.polyline); + + if (body) + { + output.push(body); + } + + } + + return output; + + }, + /** * 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. @@ -55706,7 +56151,7 @@ Phaser.TilemapParser = { } else { - return { layers: [], objects: [], images: [], tilesets: [] }; + return this.getEmptyData(); } }, @@ -55750,6 +56195,58 @@ Phaser.TilemapParser = { }, + /** + * Returns an empty map data object. + * @method Phaser.TilemapParser.getEmptyData + * @return {object} Generated map data. + */ + getEmptyData: function () { + + var map = {}; + + map.width = 0; + map.height = 0; + map.tileWidth = 0; + map.tileHeight = 0; + map.orientation = 'orthogonal'; + map.version = '1'; + map.properties = {}; + map.widthInPixels = 0; + map.heightInPixels = 0; + + var layers = []; + + var layer = { + + name: 'layer', + x: 0, + y: 0, + width: 0, + height: 0, + widthInPixels: 0, + heightInPixels: 0, + alpha: 1, + visible: true, + properties: {}, + indexes: [], + callbacks: [], + data: [] + + }; + + layers.push(layer); + + map.layers = layers; + map.images = []; + map.objects = {}; + map.collision = {}; + map.tilesets = []; + map.tiles = []; + + return map; + + }, + /** * Parses a Tiled JSON file into valid map data. * @method Phaser.TilemapParser.parseJSON @@ -55800,7 +56297,8 @@ Phaser.TilemapParser = { visible: json.layers[i].visible, properties: {}, indexes: [], - callbacks: [] + callbacks: [], + bodies: [] }; @@ -55882,8 +56380,9 @@ Phaser.TilemapParser = { map.images = images; - // Objects + // Objects & Collision Data (polylines, etc) var objects = {}; + var collision = {}; for (var i = 0; i < json.layers.length; i++) { @@ -55893,10 +56392,11 @@ Phaser.TilemapParser = { } objects[json.layers[i].name] = []; + collision[json.layers[i].name] = []; for (var v = 0, len = json.layers[i].objects.length; v < len; v++) { - // For now we'll just support object tiles + // Object Tiles if (json.layers[i].objects[v].gid) { var object = { @@ -55912,11 +56412,37 @@ Phaser.TilemapParser = { objects[json.layers[i].name].push(object); } + else if (json.layers[i].objects[v].polyline) + { + var object = { + + name: json.layers[i].objects[v].name, + x: json.layers[i].objects[v].x, + y: json.layers[i].objects[v].y, + width: json.layers[i].objects[v].width, + height: json.layers[i].objects[v].height, + visible: json.layers[i].objects[v].visible, + properties: json.layers[i].objects[v].properties + + }; + + object.polyline = []; + + // Parse the polyline into an array + for (var p = 0; p < json.layers[i].objects[v].polyline.length; p++) + { + object.polyline.push([ json.layers[i].objects[v].polyline[p].x, json.layers[i].objects[v].polyline[p].y ]); + } + + collision[json.layers[i].name].push(object); + + } } } map.objects = objects; + map.collision = collision; // Tilesets var tilesets = []; diff --git a/build/phaser.min.js b/build/phaser.min.js index ad252e6c..edeac17a 100644 --- a/build/phaser.min.js +++ b/build/phaser.min.js @@ -1,16 +1,16 @@ -/*! Phaser v1.1.5 | (c) 2014 Photon Storm Ltd. */ -!function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof exports?module.exports=b():a.Phaser=b()}(this,function(){!function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.p2=a():"undefined"!=typeof global?self.p2=a():"undefined"!=typeof self&&(self.p2=a())}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0&&(e=1/Math.sqrt(e),a[0]=b[0]*e,a[1]=b[1]*e),a},d.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]},d.cross=function(a,b,c){var d=b[0]*c[1]-b[1]*c[0];return a[0]=a[1]=0,a[2]=d,a},d.lerp=function(a,b,c,d){var e=b[0],f=b[1];return a[0]=e+d*(c[0]-e),a[1]=f+d*(c[1]-f),a},d.transformMat2=function(a,b,c){var d=b[0],e=b[1];return a[0]=d*c[0]+e*c[1],a[1]=d*c[2]+e*c[3],a},d.forEach=function(){var a=new Float32Array(2);return function(b,c,d,e,f,g){var h,i;for(c||(c=2),d||(d=0),i=e?Math.min(e*c+d,b.length):b.length,h=d;i>h;h+=c)a[0]=b[h],a[1]=b[h+1],f(a,a,g),b[h]=a[0],b[h+1]=a[1];return b}}(),d.str=function(a){return"vec2("+a[0]+", "+a[1]+")"},"undefined"!=typeof c&&(c.vec2=d)},{}],3:[function(a,b){function c(){}var d=a("./Scalar");b.exports=c,c.lineInt=function(a,b,c){c=c||0;var e,f,g,h,i,j,k,l=[0,0];return e=a[1][1]-a[0][1],f=a[0][0]-a[1][0],g=e*a[0][0]+f*a[0][1],h=b[1][1]-b[0][1],i=b[0][0]-b[1][0],j=h*b[0][0]+i*b[0][1],k=e*i-h*f,d.eq(k,0,c)||(l[0]=(i*g-f*j)/k,l[1]=(e*j-h*g)/k),l},c.segmentsIntersect=function(a,b,c,d){var e=b[0]-a[0],f=b[1]-a[1],g=d[0]-c[0],h=d[1]-c[1];if(0==g*f-h*e)return!1;var i=(e*(c[1]-a[1])+f*(a[0]-c[0]))/(g*f-h*e),j=(g*(a[1]-c[1])+h*(c[0]-a[0]))/(h*e-g*f);return i>=0&&1>=i&&j>=0&&1>=j}},{"./Scalar":6}],4:[function(a,b){function c(){}b.exports=c,c.area=function(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1])},c.left=function(a,b,d){return c.area(a,b,d)>0},c.leftOn=function(a,b,d){return c.area(a,b,d)>=0},c.right=function(a,b,d){return c.area(a,b,d)<0},c.rightOn=function(a,b,d){return c.area(a,b,d)<=0};var d=[],e=[];c.collinear=function(a,b,f,g){if(g){var h=d,i=e;h[0]=b[0]-a[0],h[1]=b[1]-a[1],i[0]=f[0]-b[0],i[1]=f[1]-b[1];var j=h[0]*i[0]+h[1]*i[1],k=Math.sqrt(h[0]*h[0]+h[1]*h[1]),l=Math.sqrt(i[0]*i[0]+i[1]*i[1]),m=Math.acos(j/(k*l));return g>m}return 0==c.area(a,b,f)},c.sqdist=function(a,b){var c=b[0]-a[0],d=b[1]-a[1];return c*c+d*d}},{}],5:[function(a,b){function c(){this.vertices=[]}function d(a,b,c,d,e){e=e||0;var f=b[1]-a[1],h=a[0]-b[0],i=f*a[0]+h*a[1],j=d[1]-c[1],k=c[0]-d[0],l=j*c[0]+k*c[1],m=f*k-j*h;return g.eq(m,0,e)?[0,0]:[(k*i-h*l)/m,(f*l-j*i)/m]}var e=a("./Line"),f=a("./Point"),g=a("./Scalar");b.exports=c,c.prototype.at=function(a){var b=this.vertices,c=b.length;return b[0>a?a%c+c:a%c]},c.prototype.first=function(){return this.vertices[0]},c.prototype.last=function(){return this.vertices[this.vertices.length-1]},c.prototype.clear=function(){this.vertices.length=0},c.prototype.append=function(a,b,c){if("undefined"==typeof b)throw new Error("From is not given!");if("undefined"==typeof c)throw new Error("To is not given!");if(b>c-1)throw new Error("lol1");if(c>a.vertices.length)throw new Error("lol2");if(0>b)throw new Error("lol3");for(var d=b;c>d;d++)this.vertices.push(a.vertices[d])},c.prototype.makeCCW=function(){for(var a=0,b=this.vertices,c=1;cb[a][0])&&(a=c);f.left(this.at(a-1),this.at(a),this.at(a+1))||this.reverse()},c.prototype.reverse=function(){for(var a=[],b=0,c=this.vertices.length;b!==c;b++)a.push(this.vertices.pop());this.vertices=a},c.prototype.isReflex=function(a){return f.right(this.at(a-1),this.at(a),this.at(a+1))};var h=[],i=[];c.prototype.canSee=function(a,b){var c,d,g=h,j=i;if(f.leftOn(this.at(a+1),this.at(a),this.at(b))&&f.rightOn(this.at(a-1),this.at(a),this.at(b)))return!1;d=f.sqdist(this.at(a),this.at(b));for(var k=0;k!==this.vertices.length;++k)if((k+1)%this.vertices.length!==a&&k!==a&&f.leftOn(this.at(a),this.at(b),this.at(k+1))&&f.rightOn(this.at(a),this.at(b),this.at(k))&&(g[0]=this.at(a),g[1]=this.at(b),j[0]=this.at(k),j[1]=this.at(k+1),c=e.lineInt(g,j),f.sqdist(this.at(a),c)a)for(var f=a;b>=f;f++)e.vertices.push(this.vertices[f]);else{for(var f=0;b>=f;f++)e.vertices.push(this.vertices[f]);for(var f=a;f0?this.slice(a):[this]},c.prototype.slice=function(a){if(0==a.length)return[this];if(a instanceof Array&&a.length&&a[0]instanceof Array&&2==a[0].length&&a[0][0]instanceof Array){for(var b=[this],c=0;cc;c++)if(e.segmentsIntersect(a[b],a[b+1],a[c],a[c+1]))return!1;for(var b=1;bh)return console.warn("quickDecomp: max level ("+h+") reached."),a;for(var x=0;xo&&(n=o,k=l,r=y))),f.left(v.at(x+1),v.at(x),v.at(y+1))&&f.rightOn(v.at(x+1),v.at(x),v.at(y))&&(l=d(v.at(x+1),v.at(x),v.at(y),v.at(y+1)),f.left(v.at(x-1),v.at(x),l)&&(o=f.sqdist(v.vertices[x],l),m>o&&(m=o,j=l,q=y)));if(r==(q+1)%this.vertices.length)l[0]=(k[0]+j[0])/2,l[1]=(k[1]+j[1])/2,e.push(l),q>x?(t.append(v,x,q+1),t.vertices.push(l),u.vertices.push(l),0!=r&&u.append(v,r,v.vertices.length),u.append(v,0,x+1)):(0!=x&&t.append(v,x,v.vertices.length),t.append(v,0,q+1),t.vertices.push(l),u.vertices.push(l),u.append(v,r,x+1));else{if(r>q&&(q+=this.vertices.length),p=Number.MAX_VALUE,r>q)return a;for(var y=r;q>=y;++y)f.leftOn(v.at(x-1),v.at(x),v.at(y))&&f.rightOn(v.at(x+1),v.at(x),v.at(y))&&(o=f.sqdist(v.at(x),v.at(y)),p>o&&(p=o,s=y%this.vertices.length));s>x?(t.append(v,x,s+1),0!=s&&u.append(v,s,w.length),u.append(v,0,x+1)):(0!=x&&t.append(v,x,w.length),t.append(v,0,s+1),u.append(v,s,x+1))}return t.vertices.length3&&c>=0;--c)f.collinear(this.at(c-1),this.at(c),this.at(c+1),a)&&(this.vertices.splice(c%this.vertices.length,1),c--,b++);return b}},{"./Line":3,"./Point":4,"./Scalar":6}],6:[function(a,b){function c(){}b.exports=c,c.eq=function(a,b,c){return c=c||0,Math.abs(a-b) (http://steffe.se)",keywords:["p2.js","p2","physics","engine","2d"],main:"./src/p2.js",engines:{node:"*"},repository:{type:"git",url:"https://github.com/schteppe/p2.js.git"},bugs:{url:"https://github.com/schteppe/p2.js/issues"},licenses:[{type:"MIT"}],devDependencies:{jshint:"latest",nodeunit:"latest",grunt:"~0.4.0","grunt-contrib-jshint":"~0.1.1","grunt-contrib-nodeunit":"~0.1.2","grunt-contrib-concat":"~0.1.3","grunt-contrib-uglify":"*","grunt-browserify":"*",browserify:"*"},dependencies:{underscore:"*","poly-decomp":"git://github.com/schteppe/poly-decomp.js","gl-matrix":"2.0.0",jsonschema:"*"}}},{}],9:[function(a,b){function c(a){this.lowerBound=d.create(),a&&a.lowerBound&&d.copy(this.lowerBound,a.lowerBound),this.upperBound=d.create(),a&&a.upperBound&&d.copy(this.upperBound,a.upperBound)}var d=a("../math/vec2");a("../utils/Utils"),b.exports=c;var e=d.create();c.prototype.setFromPoints=function(a,b,c){var f=this.lowerBound,g=this.upperBound;d.set(f,Number.MAX_VALUE,Number.MAX_VALUE),d.set(g,-Number.MAX_VALUE,-Number.MAX_VALUE);for(var h=0;hj;j++)i[j]>g[j]&&(g[j]=i[j]),i[j]b;b++)a.lowerBound[b]this.upperBound[b]&&(this.upperBound[b]=a.upperBound[b])},c.prototype.overlaps=function(a){var b=this.lowerBound,c=this.upperBound,d=a.lowerBound,e=a.upperBound;return(d[0]<=c[0]&&c[0]<=e[0]||b[0]<=e[0]&&e[0]<=c[0])&&(d[1]<=c[1]&&c[1]<=e[1]||b[1]<=e[1]&&e[1]<=c[1])}},{"../math/vec2":33,"../utils/Utils":49}],10:[function(a,b){function c(){this.result=[],this.world=null}var d=a("../math/vec2"),e=a("../objects/Body");b.exports=c,c.prototype.setWorld=function(a){this.world=a},c.prototype.getCollisionPairs=function(){throw new Error("getCollisionPairs must be implemented in a subclass!")};var f=d.create();c.boundingRadiusCheck=function(a,b){d.sub(f,a.position,b.position);var c=d.squaredLength(f),e=a.boundingRadius+b.boundingRadius;return e*e>=c},c.aabbCheck=function(a,b){return a.aabbNeedsUpdate&&a.updateAABB(),b.aabbNeedsUpdate&&b.updateAABB(),a.aabb.overlaps(b.aabb)},c.canCollide=function(a,b){return a.motionState&e.STATIC&&b.motionState&e.STATIC?!1:a.sleepState&e.SLEEPING&&b.sleepState&e.SLEEPING?!1:!0}},{"../math/vec2":33,"../objects/Body":34}],11:[function(a,b){function d(a,b,c,d,e,f){h.apply(this),e=e||10,f=f||10,this.binsizeX=(b-a)/e,this.binsizeY=(d-c)/f,this.nx=e,this.ny=f,this.xmin=a,this.ymin=c,this.xmax=b,this.ymax=d}var e=a("../shapes/Circle"),f=a("../shapes/Plane"),g=a("../shapes/Particle"),h=a("../collision/Broadphase");a("../math/vec2"),b.exports=d,d.prototype=new h,d.prototype.getBinIndex=function(a,b){var c=this.nx,d=this.ny,e=this.xmin,f=this.ymin,g=this.xmax,h=this.ymax,i=Math.floor(c*(a-e)/(g-e)),j=Math.floor(d*(b-f)/(h-f));return i*d+j},d.prototype.getCollisionPairs=function(a){for(var b=[],d=a.bodies,i=i=d.length,j=this.binsizeX,k=this.binsizeY,l=[],m=nx*ny,n=0;m>n;n++)l.push([]);for(var o=nx/(xmax-xmin),p=ny/(ymax-ymin),n=0;n!==i;n++){var q=d[n],r=q.shape;if(void 0!==r)if(r instanceof e)for(var s=q.position[0],t=q.position[1],u=r.radius,v=Math.floor(o*(s-u-xmin)),w=Math.floor(p*(t-u-ymin)),x=Math.floor(o*(s+u-xmin)),y=Math.floor(p*(t+u-ymin)),z=v;x>=z;z++)for(var A=w;y>=A;A++){var B=z,C=A;B*(ny-1)+C>=0&&m>B*(ny-1)+C&&l[B*(ny-1)+C].push(q)}else{if(!(r instanceof f))throw new Error("Shape not supported in GridBroadphase!");if(0==q.angle)for(var t=q.position[1],z=0;z!==m&&t>ymin+k*(z-1);z++)for(var A=0;nx>A;A++){var B=A,C=Math.floor(p*(k*z-ymin));l[B*(ny-1)+C].push(q)}else if(q.angle==.5*Math.PI)for(var s=q.position[0],z=0;z!==m&&s>xmin+j*(z-1);z++)for(var A=0;ny>A;A++){var C=A,B=Math.floor(o*(j*z-xmin));l[B*(ny-1)+C].push(q)}else for(var z=0;z!==m;z++)l[z].push(q)}}for(var n=0;n!==m;n++)for(var D=l[n],z=0,E=D.length;z!==E;z++)for(var q=D[z],r=q.shape,A=0;A!==z;A++){var F=D[A],G=F.shape;r instanceof e?G instanceof e?c=h.circleCircle(q,F):G instanceof g?c=h.circleParticle(q,F):G instanceof f&&(c=h.circlePlane(q,F)):r instanceof g?G instanceof e&&(c=h.circleParticle(F,q)):r instanceof f&&G instanceof e&&(c=h.circlePlane(F,q))}return b}},{"../collision/Broadphase":10,"../math/vec2":33,"../shapes/Circle":38,"../shapes/Particle":41,"../shapes/Plane":42}],12:[function(a,b){function c(){d.apply(this),this.useBoundingBoxes=!1}var d=(a("../shapes/Circle"),a("../shapes/Plane"),a("../shapes/Shape"),a("../shapes/Particle"),a("../collision/Broadphase"));a("../math/vec2"),b.exports=c,c.prototype=new d,c.prototype.getCollisionPairs=function(a){var b,c,e,f,g=a.bodies,h=this.result,i=this.useBoundingBoxes?d.aabbCheck:d.boundingRadiusCheck;for(h.length=0,b=0,Ncolliding=g.length;b!==Ncolliding;b++)for(e=g[b],c=0;b>c;c++)f=g[c],d.canCollide(e,f)&&i(e,f)&&h.push(e,f);return h}},{"../collision/Broadphase":10,"../math/vec2":33,"../shapes/Circle":38,"../shapes/Particle":41,"../shapes/Plane":42,"../shapes/Shape":44}],13:[function(a,b){function c(){this.contactEquations=[],this.frictionEquations=[],this.enableFriction=!0,this.slipForce=10,this.frictionCoefficient=.3,this.reuseObjects=!0,this.reusableContactEquations=[],this.reusableFrictionEquations=[],this.restitution=0,this.collidingBodiesLastStep={keys:[]}}function d(a){for(var b=0,c=a.keys.length;c>b;b++)delete a[a.keys[b]];a.keys.length=0}function e(a,b,c,d){for(var e=J,i=K,j=L,k=M,l=a,m=b.vertices,n=null,o=0;o!==m.length+1;o++){var p=m[o%m.length],q=m[(o+1)%m.length];f.rotate(e,p,d),f.rotate(i,q,d),h(e,e,c),h(i,i,c),g(j,e,l),g(k,i,l);var r=f.crossLength(j,k);if(null===n&&(n=r),0>=r*n)return!1;n=r}return!0}var f=a("../math/vec2"),g=f.sub,h=f.add,i=f.dot,j=a("../utils/Utils"),k=a("../equations/ContactEquation"),l=a("../equations/FrictionEquation"),m=a("../shapes/Circle"),n=a("../shapes/Shape"),o=a("../objects/Body");b.exports=c;var p=f.fromValues(0,1),q=f.fromValues(0,0),r=f.fromValues(0,0),s=f.fromValues(0,0),t=f.fromValues(0,0),u=f.fromValues(0,0),v=f.fromValues(0,0),w=f.fromValues(0,0),x=f.fromValues(0,0),y=f.fromValues(0,0),z=f.fromValues(0,0),A=f.fromValues(0,0),B=f.fromValues(0,0),C=f.fromValues(0,0),D=f.fromValues(0,0),E=f.fromValues(0,0),F=f.fromValues(0,0),G=f.fromValues(0,0),H=f.fromValues(0,0),I=[];c.prototype.collidedLastStep=function(a,b){var c=a.id,d=b.id;if(c>d){var e=c;c=d,d=e}return!!this.collidingBodiesLastStep[c+" "+d]},c.prototype.reset=function(a){if(a&&a.emitSeparationEvent)for(var b=0;bg){var n=e;e=g,g=n}var c=e+" "+g;this.collidingBodiesLastStep[c]||(this.collidingBodiesLastStep[c]=!0,this.collidingBodiesLastStep.keys.push(c))}if(this.reuseObjects){var o=this.contactEquations,p=this.frictionEquations,q=this.reusableFrictionEquations,r=this.reusableContactEquations;j.appendArray(r,o),j.appendArray(q,p)}this.contactEquations.length=this.frictionEquations.length=0},c.prototype.createContactEquation=function(a,b,c,d){var e=this.reusableContactEquations.length?this.reusableContactEquations.pop():new k(a,b);return e.bi=a,e.bj=b,e.shapeA=c,e.shapeB=d,e.restitution=this.restitution,e.firstImpact=!this.collidedLastStep(a,b),a.allowSleep&&a.motionState&o.DYNAMIC&&!(b.motionState&o.STATIC||b.sleepState===o.SLEEPY)&&a.wakeUp(),b.allowSleep&&b.motionState&o.DYNAMIC&&!(a.motionState&o.STATIC||a.sleepState===o.SLEEPY)&&b.wakeUp(),e},c.prototype.createFrictionEquation=function(a,b,c,d){var e=this.reusableFrictionEquations.length?this.reusableFrictionEquations.pop():new l(a,b);return e.bi=a,e.bj=b,e.shapeA=c,e.shapeB=d,e.setSlipForce(this.slipForce),e.frictionCoefficient=this.frictionCoefficient,e},c.prototype.createFrictionFromContact=function(a){var b=this.createFrictionEquation(a.bi,a.bj,a.shapeA,a.shapeB);return f.copy(b.ri,a.ri),f.copy(b.rj,a.rj),f.rotate(b.t,a.ni,-Math.PI/2),b.contactEquation=a,b},c.prototype[n.LINE|n.CONVEX]=c.prototype.convexLine=function(){return 0},c.prototype[n.LINE|n.RECTANGLE]=c.prototype.lineRectangle=function(){return 0},c.prototype[n.CAPSULE|n.RECTANGLE]=c.prototype.rectangleCapsule=function(){return 0},c.prototype[n.CAPSULE|n.CONVEX]=c.prototype.convexCapsule=function(){return 0},c.prototype[n.CAPSULE|n.LINE]=c.prototype.lineCapsule=function(){return 0},c.prototype[n.CAPSULE|n.CAPSULE]=c.prototype.capsuleCapsule=function(){return 0},c.prototype[n.LINE|n.LINE]=c.prototype.lineLine=function(){return 0},c.prototype[n.PLANE|n.LINE]=c.prototype.planeLine=function(a,b,c,d,e,j,k,l){var m=q,n=r,o=s,z=t,A=u,B=v,C=w,D=x,E=y,F=I;numContacts=0,f.set(m,-j.length/2,0),f.set(n,j.length/2,0),f.rotate(o,m,l),f.rotate(z,n,l),h(o,o,k),h(z,z,k),f.copy(m,o),f.copy(n,z),g(A,n,m),f.normalize(B,A),f.rotate(E,B,-Math.PI/2),f.rotate(D,p,d),F[0]=m,F[1]=n;for(var G=0;GJ){var K=this.createContactEquation(a,e,b,j);numContacts++,f.copy(K.ni,D),f.normalize(K.ni,K.ni),f.scale(C,D,J),g(K.ri,H,C),g(K.ri,K.ri,a.position),g(K.rj,H,k),h(K.rj,K.rj,k),g(K.rj,K.rj,e.position),this.contactEquations.push(K),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(K))}}return numContacts},c.prototype[n.PARTICLE|n.CAPSULE]=c.prototype.particleCapsule=function(a,b,c,d,e,f,g,h,i){return this.circleLine(a,b,c,d,e,f,g,h,i,f.radius,0)},c.prototype[n.CIRCLE|n.LINE]=c.prototype.circleLine=function(a,b,c,d,e,j,k,l,m,n,o){var p=j,E=l,F=e,G=k,H=c,J=a,K=b,n=n||0,o="undefined"!=typeof o?o:K.radius,L=q,M=r,N=s,O=t,P=u,Q=v,R=w,S=x,T=y,U=z,V=A,W=B,X=C,Y=D,Z=I;f.set(S,-p.length/2,0),f.set(T,p.length/2,0),f.rotate(U,S,E),f.rotate(V,T,E),h(U,U,G),h(V,V,G),f.copy(S,U),f.copy(T,V),g(Q,T,S),f.normalize(R,Q),f.rotate(P,R,-Math.PI/2),g(W,H,S);var $=i(W,P);if(g(O,S,G),g(X,H,G),Math.abs($)ab&&bb>_){if(m)return 1;var cb=this.createContactEquation(J,F,b,j);return f.scale(cb.ni,L,-1),f.normalize(cb.ni,cb.ni),f.scale(cb.ri,cb.ni,o),h(cb.ri,cb.ri,H),g(cb.ri,cb.ri,J.position),g(cb.rj,N,G),h(cb.rj,cb.rj,G),g(cb.rj,cb.rj,F.position),this.contactEquations.push(cb),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(cb)),1}}Z[0]=S,Z[1]=T;for(var db=0;dbW&&(f.copy(Q,O),S=W,f.scale(N,K,W),f.add(N,N,O),R=!0)}}if(R){var X=this.createContactEquation(y,v,b,j);return f.sub(X.ni,Q,x),f.normalize(X.ni,X.ni),f.scale(X.ri,X.ni,n),h(X.ri,X.ri,x),g(X.ri,X.ri,y.position),g(X.rj,N,w),h(X.rj,X.rj,w),g(X.rj,X.rj,v.position),this.contactEquations.push(X),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(X)),1}if(n>0)for(var T=0;TV&&(P=V,f.scale(M,I,V),f.add(M,M,y),f.copy(O,I),Q=!0)}if(Q){var W=this.createContactEquation(A,p,b,k);return f.scale(W.ni,O,-1),f.normalize(W.ni,W.ni),f.set(W.ri,0,0),h(W.ri,W.ri,y),g(W.ri,W.ri,A.position),g(W.rj,M,x),h(W.rj,W.rj,x),g(W.rj,W.rj,p.position),this.contactEquations.push(W),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(W)),1}return 0},c.prototype[n.CIRCLE]=c.prototype.circleCircle=function(a,b,c,d,e,i,j,k,l){var m=a,n=b,o=c,p=e,r=i,s=j,t=q;g(t,c,j);var u=b.radius+i.radius;if(f.squaredLength(t)>u*u)return 0;if(l)return 1;var v=this.createContactEquation(m,p,b,i);return g(v.ni,s,o),f.normalize(v.ni,v.ni),f.scale(v.ri,v.ni,n.radius),f.scale(v.rj,v.ni,-r.radius),h(v.ri,v.ri,o),g(v.ri,v.ri,m.position),h(v.rj,v.rj,s),g(v.rj,v.rj,p.position),this.contactEquations.push(v),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(v)),1},c.prototype[n.PLANE|n.CONVEX]=c.prototype.planeConvex=function(a,b,c,d,e,j,k,l){var m=e,n=k,o=j,t=l,u=a,v=b,w=c,x=d,y=q,z=r,A=s,B=0;f.rotate(z,p,x);for(var C=0;C=2)break}}return B},c.prototype.convexPlane=function(a,b,c,d,e,f,g,h){return console.warn("Narrowphase.prototype.convexPlane is deprecated. Use planeConvex instead!"),this.planeConvex(e,f,g,h,a,b,c,d)},c.prototype[n.PARTICLE|n.PLANE]=c.prototype.particlePlane=function(a,b,c,d,e,h,j,k,l){var m=a,n=c,o=e,s=j,t=k,u=q,v=r;t=t||0,g(u,n,s),f.rotate(v,p,t);var w=i(u,v);if(w>0)return 0;if(l)return 1;var x=this.createContactEquation(o,m,h,b);return f.copy(x.ni,v),f.scale(u,x.ni,w),g(x.ri,n,u),g(x.ri,x.ri,o.position),g(x.rj,n,m.position),this.contactEquations.push(x),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(x)),1},c.prototype[n.CIRCLE|n.PARTICLE]=c.prototype.circleParticle=function(a,b,c,d,e,i,j,k,l){var m=a,n=b,o=c,p=e,r=j,s=q;if(g(s,r,o),f.squaredLength(s)>n.radius*n.radius)return 0;if(l)return 1;var t=this.createContactEquation(m,p,b,i);return f.copy(t.ni,s),f.normalize(t.ni,t.ni),f.scale(t.ri,t.ni,n.radius),h(t.ri,t.ri,o),g(t.ri,t.ri,m.position),g(t.rj,r,p.position),this.contactEquations.push(t),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(t)),1};{var N=new m(1),O=f.create(),P=f.create();f.create()}c.prototype[n.PLANE|n.CAPSULE]=c.prototype.planeCapsule=function(a,b,c,d,e,g,i,j){var k=O,l=P,m=N;f.set(k,-g.length/2,0),f.rotate(k,k,j),h(k,k,i),f.set(l,g.length/2,0),f.rotate(l,l,j),h(l,l,i),m.radius=g.radius;var n=this.circlePlane(e,m,k,0,a,b,c,d),o=this.circlePlane(e,m,l,0,a,b,c,d);return n+o},c.prototype.capsulePlane=function(a,b,c,d,e,f,g,h){return console.warn("Narrowphase.prototype.capsulePlane() is deprecated. Use .planeCapsule() instead!"),this.planeCapsule(e,f,g,h,a,b,c,d)},c.prototype[n.CIRCLE|n.PLANE]=c.prototype.circlePlane=function(a,b,c,d,e,j,k,l){var m=a,n=b,o=c,t=e,u=k,v=l;v=v||0;var w=q,x=r,y=s;g(w,o,u),f.rotate(x,p,v);var z=i(x,w);if(z>n.radius)return 0;var A=this.createContactEquation(t,m,j,b);return f.copy(A.ni,x),f.scale(A.rj,A.ni,-n.radius),h(A.rj,A.rj,o),g(A.rj,A.rj,m.position),f.scale(y,A.ni,z),g(A.ri,w,y),h(A.ri,A.ri,u),g(A.ri,A.ri,t.position),this.contactEquations.push(A),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(A)),1},c.prototype[n.CONVEX]=c.prototype.convexConvex=function(a,b,d,e,j,k,l,m,n){var o=q,p=r,v=s,z=t,A=u,B=w,C=x,D=y,E=0,n=n||1e-10,F=c.findSeparatingAxis(b,d,e,k,l,m,o);if(!F)return 0;g(C,l,d),i(o,C)>0&&f.scale(o,o,-1);var G=c.getClosestEdge(b,e,o,!0),H=c.getClosestEdge(k,m,o);if(-1==G||-1==H)return 0;for(var I=0;2>I;I++){var J=G,K=H,L=b,M=k,N=d,O=l,P=e,Q=m,R=a,S=j;if(0==I){var T;T=J,J=K,K=T,T=L,L=M,M=T,T=N,N=O,O=T,T=P,P=Q,Q=T,T=R,R=S,S=T}for(var U=K;K+2>U;U++){var V=M.vertices[(U+M.vertices.length)%M.vertices.length];f.rotate(p,V,Q),h(p,p,O);for(var W=0,X=J-1;J+2>X;X++){var Y=L.vertices[(X+L.vertices.length)%L.vertices.length],Z=L.vertices[(X+1+L.vertices.length)%L.vertices.length];f.rotate(v,Y,P),f.rotate(z,Z,P),h(v,v,N),h(z,z,N),g(A,z,v),f.rotate(D,A,-Math.PI/2),f.normalize(D,D),g(C,p,v);var $=i(D,C);n>=$&&W++}if(3==W){var _=this.createContactEquation(R,S,L,M);E++;var Y=L.vertices[J%L.vertices.length],Z=L.vertices[(J+1)%L.vertices.length];f.rotate(v,Y,P),f.rotate(z,Z,P),h(v,v,N),h(z,z,N),g(A,z,v),f.rotate(_.ni,A,-Math.PI/2),f.normalize(_.ni,_.ni),g(C,p,v);var $=i(_.ni,C);f.scale(B,_.ni,$),g(_.ri,p,N),g(_.ri,_.ri,B),h(_.ri,_.ri,N),g(_.ri,_.ri,R.position),g(_.rj,p,O),h(_.rj,_.rj,O),g(_.rj,_.rj,S.position),this.contactEquations.push(_),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(_))}}}return E};var Q=f.fromValues(0,0);c.projectConvexOntoAxis=function(a,b,c,d,e){var g,h,j=null,k=null,l=Q;f.rotate(l,d,-c);for(var m=0;mj)&&(j=h),(null===k||k>h)&&(k=h);if(k>j){var n=k;k=j,j=n}var o=i(b,d);f.set(e,k+o,j+o)};var R=f.fromValues(0,0),S=f.fromValues(0,0),T=f.fromValues(0,0),U=f.fromValues(0,0),V=f.fromValues(0,0),W=f.fromValues(0,0);c.findSeparatingAxis=function(a,b,d,e,h,i,j){for(var k=null,l=!1,m=!1,n=R,o=S,p=T,q=U,r=V,s=W,t=0;2!==t;t++){var u=a,v=d;1===t&&(u=e,v=i);for(var w=0;w!==u.vertices.length;w++){f.rotate(o,u.vertices[w],v),f.rotate(p,u.vertices[(w+1)%u.vertices.length],v),g(n,p,o),f.rotate(q,n,-Math.PI/2),f.normalize(q,q),c.projectConvexOntoAxis(a,b,d,q,r),c.projectConvexOntoAxis(e,h,i,q,s);var x=r,y=s,z=!1;r[0]>s[0]&&(y=r,x=s,z=!0);var A=y[0]-x[1];l=0>A,(null===k||A>k)&&(f.copy(j,q),k=A,m=l)}}return m};var X=f.fromValues(0,0),Y=f.fromValues(0,0),Z=f.fromValues(0,0);c.getClosestEdge=function(a,b,c,d){var e=X,h=Y,j=Z;f.rotate(e,c,-b),d&&f.scale(e,e,-1);for(var k=-1,l=a.vertices.length,m=Math.PI/2,n=0;n!==l;n++){g(h,a.vertices[(n+1)%l],a.vertices[n%l]),f.rotate(j,h,-m),f.normalize(j,j);var o=i(j,e);(-1==k||o>maxDot)&&(k=n%l,maxDot=o)}return k}},{"../equations/ContactEquation":23,"../equations/FrictionEquation":25,"../math/vec2":33,"../objects/Body":34,"../shapes/Circle":38,"../shapes/Shape":44,"../utils/Utils":49}],14:[function(a,b){function c(a,b,c,f){var g;g=b?new d(a,0,c,f):new e(a,0,c,f),this.root=g}function d(a,b,c,d){this.bounds=a,this.children=[],this.nodes=[],d&&(this.maxChildren=d),c&&(this.maxDepth=c),b&&(this.depth=b)}function e(a,b,c,e){d.call(this,a,b,c,e),this.stuckChildren=[]}var f=a("../shapes/Plane"),g=a("../collision/Broadphase");b.exports={QuadTree:c,Node:d,BoundsNode:e},c.prototype.insert=function(a){if(a instanceof Array)for(var b=a.length,c=0;b>c;c++)this.root.insert(a[c]);else this.root.insert(a)},c.prototype.clear=function(){this.root.clear()},c.prototype.retrieve=function(a){var b=this.root.retrieve(a).slice(0);return b},c.prototype.getCollisionPairs=function(a){var b=[];this.insert(a.bodies);for(var c=0;c!==a.bodies.length;c++)for(var d=a.bodies[c],e=this.retrieve(d),f=0,h=e.length;f!==h;f++){var i=e[f];if(d!==i){for(var j=!1,k=0,l=b.length;l>k;k+=2){var m=b[k],n=b[k+1];if(m==i&&n==d||n==i&&m==d){j=!0;break}}!j&&g.boundingRadiusCheck(d,i)&&b.push(d,i)}}return this.clear(),b},d.prototype.classConstructor=d,d.prototype.children=null,d.prototype.depth=0,d.prototype.maxChildren=4,d.prototype.maxDepth=4,d.TOP_LEFT=0,d.TOP_RIGHT=1,d.BOTTOM_LEFT=2,d.BOTTOM_RIGHT=3,d.prototype.insert=function(a){if(this.nodes.length){var b=this.findIndex(a);return this.nodes[b].insert(a),void 0}this.children.push(a);var c=this.children.length;if(!(this.depth>=this.maxDepth)&&c>this.maxChildren){this.subdivide(); -for(var d=0;c>d;d++)this.insert(this.children[d]);this.children.length=0}},d.prototype.retrieve=function(a){if(this.nodes.length){var b=this.findIndex(a);return this.nodes[b].retrieve(a)}return this.children},d.prototype.findIndex=function(a){var b=this.bounds,c=a.position[0]-a.boundingRadius>b.x+b.width/2?!1:!0,e=a.position[1]-a.boundingRadius>b.y+b.height/2?!1:!0;a instanceof f&&(c=e=!1);var g=d.TOP_LEFT;return c?e||(g=d.BOTTOM_LEFT):g=e?d.TOP_RIGHT:d.BOTTOM_RIGHT,g},d.prototype.subdivide=function(){var a=this.depth+1,b=this.bounds.x,c=this.bounds.y,e=this.bounds.width/2,f=this.bounds.height/2,g=b+e,h=c+f;this.nodes[d.TOP_LEFT]=new this.classConstructor({x:b,y:c,width:e,height:f},a),this.nodes[d.TOP_RIGHT]=new this.classConstructor({x:g,y:c,width:e,height:f},a),this.nodes[d.BOTTOM_LEFT]=new this.classConstructor({x:b,y:h,width:e,height:f},a),this.nodes[d.BOTTOM_RIGHT]=new this.classConstructor({x:g,y:h,width:e,height:f},a)},d.prototype.clear=function(){this.children.length=0;for(var a=this.nodes.length,b=0;a>b;b++)this.nodes[b].clear();this.nodes.length=0},e.prototype=new d,e.prototype.classConstructor=e,e.prototype.stuckChildren=null,e.prototype.out=[],e.prototype.insert=function(a){if(this.nodes.length){var b=this.findIndex(a),c=this.nodes[b];return!(a instanceof f)&&a.position[0]-a.boundingRadius>=c.bounds.x&&a.position[0]+a.boundingRadius<=c.bounds.x+c.bounds.width&&a.position[1]-a.boundingRadius>=c.bounds.y&&a.position[1]+a.boundingRadius<=c.bounds.y+c.bounds.height?this.nodes[b].insert(a):this.stuckChildren.push(a),void 0}this.children.push(a);var d=this.children.length;if(this.depththis.maxChildren){this.subdivide();for(var e=0;d>e;e++)this.insert(this.children[e]);this.children.length=0}},e.prototype.getChildren=function(){return this.children.concat(this.stuckChildren)},e.prototype.retrieve=function(a){var b=this.out;if(b.length=0,this.nodes.length){var c=this.findIndex(a);b.push.apply(b,this.nodes[c].retrieve(a))}return b.push.apply(b,this.stuckChildren),b.push.apply(b,this.children),b},e.prototype.clear=function(){this.stuckChildren.length=0,this.children.length=0;var a=this.nodes.length;if(a){for(var b=0;a>b;b++)this.nodes[b].clear();this.nodes.length=0}}},{"../collision/Broadphase":10,"../shapes/Plane":42}],15:[function(a,b){function c(){e.apply(this),this.axisList=[],this.world=null,this.axisIndex=0;var a=this.axisList;this._addBodyHandler=function(b){a.push(b.body)},this._removeBodyHandler=function(b){var c=a.indexOf(b.body);-1!==c&&a.splice(c,1)}}var d=(a("../shapes/Circle"),a("../shapes/Plane"),a("../shapes/Shape"),a("../shapes/Particle"),a("../utils/Utils")),e=a("../collision/Broadphase");a("../math/vec2"),b.exports=c,c.prototype=new e,c.prototype.setWorld=function(a){this.axisList.length=0,d.appendArray(this.axisList,a.bodies),a.off("addBody",this._addBodyHandler).off("removeBody",this._removeBodyHandler),a.on("addBody",this._addBodyHandler).on("removeBody",this._removeBodyHandler),this.world=a},c.sortAxisListX=function(a,b){return a.position[0]-a.boundingRadius-(b.position[0]-b.boundingRadius)},c.sortAxisListY=function(a,b){return a.position[1]-a.boundingRadius-(b.position[1]-b.boundingRadius)},c.prototype.getCollisionPairs=function(){var a,b,d=this.axisList,f=this.result,g=this.axisIndex;for(f.length=0,d.sort(0===g?c.sortAxisListX:c.sortAxisListY),a=0,N=d.length;a!==N;a++){var h=d[a];for(b=a+1;N>b;b++){var i=d[b];if(!c.checkBounds(h,i,g))break;e.boundingRadiusCheck(h,i)&&f.push(h,i)}}return f},c.checkBounds=function(a,b,c){var d=a.position[c],e=a.boundingRadius,f=b.position[c],g=b.boundingRadius,h=d+e,i=f-g;return h>i}},{"../collision/Broadphase":10,"../math/vec2":33,"../shapes/Circle":38,"../shapes/Particle":41,"../shapes/Plane":42,"../shapes/Shape":44,"../utils/Utils":49}],16:[function(a,b){function c(a,b){this.equations=[],this.bodyA=a,this.bodyB=b,a&&a.wakeUp(),b&&b.wakeUp()}b.exports=c},{}],17:[function(a,b){function c(a,b,c,g){d.call(this,a,b),this.distance=c,"undefined"==typeof g&&(g=Number.MAX_VALUE);var h=new e(a,b,-g,g);this.equations=[h];var i=f.create();h.computeGq=function(){return f.sub(i,b.position,a.position),f.length(i)-c},this.setMaxForce(g)}var d=a("./Constraint"),e=a("../equations/Equation"),f=a("../math/vec2");b.exports=c,c.prototype=new d;var g=f.create();c.prototype.update=function(){var a=this.equations[0],b=this.bodyA,c=this.bodyB,d=(this.distance,a.G);f.sub(g,c.position,b.position),f.normalize(g,g),d[0]=-g[0],d[1]=-g[1],d[3]=g[0],d[4]=g[1]},c.prototype.setMaxForce=function(a){var b=this.equations[0];b.minForce=-a,b.maxForce=a},c.prototype.getMaxForce=function(){var a=this.equations[0];return a.maxForce}},{"../equations/Equation":24,"../math/vec2":33,"./Constraint":16}],18:[function(a,b){function c(a,b,c){d.call(this,a,b),this.equations=[new e(a,b,c)],this.angle="number"==typeof c.angle?c.angle:0,this.ratio="number"==typeof c.ratio?c.ratio:1}var d=a("./Constraint"),e=(a("../equations/Equation"),a("../equations/AngleLockEquation"));a("../math/vec2"),b.exports=c,c.prototype=new d,c.prototype.update=function(){var a=this.equations[0];a.ratio!=this.ratio&&a.setRatio(this.ratio),a.angle=this.angle}},{"../equations/AngleLockEquation":22,"../equations/Equation":24,"../math/vec2":33,"./Constraint":16}],19:[function(a,b){function c(a,b,c){d.call(this,a,b);var g="undefined"==typeof c.maxForce?Number.MAX_VALUE:c.maxForce,h=c.localOffsetB||e.fromValues(0,0);h=e.fromValues(h[0],h[1]);var i=c.localAngleB||0,j=new f(a,b,-g,g),k=new f(a,b,-g,g),l=new f(a,b,-g,g),m=e.create(),n=e.create();j.computeGq=function(){return e.rotate(m,h,a.angle),e.sub(n,b.position,a.position),e.sub(n,n,m),n[0]},k.computeGq=function(){return e.rotate(m,h,a.angle),e.sub(n,b.position,a.position),e.sub(n,n,m),n[1]};var o=e.create(),p=e.create();l.computeGq=function(){return e.rotate(o,h,b.angle-i),e.scale(o,o,-1),e.sub(n,a.position,b.position),e.add(n,n,o),e.rotate(p,o,-Math.PI/2),e.normalize(p,p),e.dot(n,p)},this.localOffsetB=h,this.localAngleB=i,this.maxForce=g,this.equations=[j,k,l]}var d=a("./Constraint"),e=a("../math/vec2"),f=a("../equations/Equation");b.exports=c,c.prototype=new d;var g=e.create(),h=e.create(),i=e.create(),j=e.fromValues(1,0),k=e.fromValues(0,1);c.prototype.update=function(){var a=this.equations[0],b=this.equations[1],c=this.equations[2],d=this.bodyA,f=this.bodyB;e.rotate(g,this.localOffsetB,d.angle),e.rotate(h,this.localOffsetB,f.angle-this.localAngleB),e.scale(h,h,-1),e.rotate(i,h,Math.PI/2),e.normalize(i,i),a.G[0]=-1,a.G[1]=0,a.G[2]=-e.crossLength(g,j),a.G[3]=1,b.G[0]=0,b.G[1]=-1,b.G[2]=-e.crossLength(g,k),b.G[4]=1,c.G[0]=-i[0],c.G[1]=-i[1],c.G[3]=i[0],c.G[4]=i[1],c.G[5]=e.crossLength(h,i)}},{"../equations/Equation":24,"../math/vec2":33,"./Constraint":16}],20:[function(a,b){function c(a,b,c){c=c||{},d.call(this,a,b);var i=g.fromValues(0,0),j=g.fromValues(1,0),k=g.fromValues(0,0);c.localAnchorA&&g.copy(i,c.localAnchorA),c.localAxisA&&g.copy(j,c.localAxisA),c.localAnchorB&&g.copy(k,c.localAnchorB),this.localAnchorA=i,this.localAnchorB=k,this.localAxisA=j;var l=this.maxForce="undefined"!=typeof c.maxForce?c.maxForce:Number.MAX_VALUE,m=new f(a,b,-l,l),n=new g.create,o=new g.create,p=new g.create,q=new g.create;if(m.computeGq=function(){return g.dot(p,q)},m.update=function(){var c=this.G,d=a.position,e=b.position;g.rotate(n,i,a.angle),g.rotate(o,k,b.angle),g.add(p,e,o),g.sub(p,p,d),g.sub(p,p,n),g.rotate(q,j,a.angle+Math.PI/2),c[0]=-q[0],c[1]=-q[1],c[2]=-g.crossLength(n,q)+g.crossLength(q,p),c[3]=q[0],c[4]=q[1],c[5]=g.crossLength(o,q)},this.equations.push(m),!c.disableRotationalLock){var r=new h(a,b,-l,l);this.equations.push(r)}this.position=0,this.velocity=0,this.lowerLimitEnabled=!1,this.upperLimitEnabled=!1,this.lowerLimit=0,this.upperLimit=1,this.upperLimitEquation=new e(a,b),this.lowerLimitEquation=new e(a,b),this.upperLimitEquation.minForce=this.lowerLimitEquation.minForce=0,this.upperLimitEquation.maxForce=this.lowerLimitEquation.maxForce=l,this.motorEquation=new f(a,b),this.motorEnabled=!1,this.motorSpeed=0;var s=this,t=this.motorEquation;t.computeGW,t.computeGq=function(){return 0},t.computeGW=function(){var a=this.G,b=this.bi,c=this.bj,d=b.velocity,e=c.velocity,f=b.angularVelocity,g=c.angularVelocity;return this.transformedGmult(a,d,f,e,g)+s.motorSpeed}}var d=a("./Constraint"),e=a("../equations/ContactEquation"),f=a("../equations/Equation"),g=a("../math/vec2"),h=a("../equations/RotationalLockEquation");b.exports=c,c.prototype=new d;var i=g.create(),j=g.create(),k=g.create(),l=g.create(),m=g.create(),n=g.create();c.prototype.update=function(){var a=this.equations,b=a[0],c=this.upperLimit,d=this.lowerLimit,e=this.upperLimitEquation,f=this.lowerLimitEquation,h=this.bodyA,o=this.bodyB,p=this.localAxisA,q=this.localAnchorA,r=this.localAnchorB;b.update(),g.rotate(i,p,h.angle),g.rotate(l,q,h.angle),g.add(j,l,h.position),g.rotate(m,r,o.angle),g.add(k,m,o.position);var s=this.position=g.dot(k,i)-g.dot(j,i);if(this.motorEnabled){var t=this.motorEquation.G;t[0]=i[0],t[1]=i[1],t[2]=g.crossLength(i,m),t[3]=-i[0],t[4]=-i[1],t[5]=-g.crossLength(i,l)}if(this.upperLimitEnabled&&s>c)g.scale(e.ni,i,-1),g.sub(e.ri,j,h.position),g.sub(e.rj,k,o.position),g.scale(n,i,c),g.add(e.ri,e.ri,n),-1==a.indexOf(e)&&a.push(e);else{var u=a.indexOf(e);-1!=u&&a.splice(u,1)}if(this.lowerLimitEnabled&&d>s)g.scale(f.ni,i,1),g.sub(f.ri,j,h.position),g.sub(f.rj,k,o.position),g.scale(n,i,d),g.sub(f.rj,f.rj,n),-1==a.indexOf(f)&&a.push(f);else{var u=a.indexOf(f);-1!=u&&a.splice(u,1)}},c.prototype.enableMotor=function(){this.motorEnabled||(this.equations.push(this.motorEquation),this.motorEnabled=!0)},c.prototype.disableMotor=function(){if(this.motorEnabled){var a=this.equations.indexOf(this.motorEquation);this.equations.splice(a,1),this.motorEnabled=!1}}},{"../equations/ContactEquation":23,"../equations/Equation":24,"../equations/RotationalLockEquation":26,"../math/vec2":33,"./Constraint":16}],21:[function(a,b){function c(a,b,c,n,o){d.call(this,a,c),o=this.maxForce="undefined"!=typeof o?o:Number.MAX_VALUE,this.pivotA=b,this.pivotB=n;var p=this.equations=[new e(a,c,-o,o),new e(a,c,-o,o)],q=p[0],r=p[1];q.computeGq=function(){return h.rotate(i,b,a.angle),h.rotate(j,n,c.angle),h.add(m,c.position,j),h.sub(m,m,a.position),h.sub(m,m,i),h.dot(m,k)},r.computeGq=function(){return h.rotate(i,b,a.angle),h.rotate(j,n,c.angle),h.add(m,c.position,j),h.sub(m,m,a.position),h.sub(m,m,i),h.dot(m,l)},r.minForce=q.minForce=-o,r.maxForce=q.maxForce=o,this.motorEquation=new f(a,c),this.motorEnabled=!1,this.angle=0,this.lowerLimitEnabled=!1,this.upperLimitEnabled=!1,this.lowerLimit=0,this.upperLimit=0,this.upperLimitEquation=new g(a,c),this.lowerLimitEquation=new g(a,c),this.upperLimitEquation.minForce=0,this.lowerLimitEquation.maxForce=0}var d=a("./Constraint"),e=a("../equations/Equation"),f=a("../equations/RotationalVelocityEquation"),g=a("../equations/RotationalLockEquation"),h=a("../math/vec2");b.exports=c;var i=h.create(),j=h.create(),k=h.fromValues(1,0),l=h.fromValues(0,1),m=h.create();c.prototype=new d,c.prototype.update=function(){var a=this.bodyA,b=this.bodyB,c=this.pivotA,d=this.pivotB,e=this.equations,f=(e[0],e[1],e[0]),g=e[1],m=this.upperLimit,n=this.lowerLimit,o=this.upperLimitEquation,p=this.lowerLimitEquation,q=this.angle=b.angle-a.angle;if(this.upperLimitEnabled&&q>m)o.angle=m,-1==e.indexOf(o)&&e.push(o);else{var r=e.indexOf(o);-1!=r&&e.splice(r,1)}if(this.lowerLimitEnabled&&n>q)p.angle=n,-1==e.indexOf(p)&&e.push(p);else{var r=e.indexOf(p);-1!=r&&e.splice(r,1)}h.rotate(i,c,a.angle),h.rotate(j,d,b.angle),f.G[0]=-1,f.G[1]=0,f.G[2]=-h.crossLength(i,k),f.G[3]=1,f.G[4]=0,f.G[5]=h.crossLength(j,k),g.G[0]=0,g.G[1]=-1,g.G[2]=-h.crossLength(i,l),g.G[3]=0,g.G[4]=1,g.G[5]=h.crossLength(j,l)},c.prototype.enableMotor=function(){this.motorEnabled||(this.equations.push(this.motorEquation),this.motorEnabled=!0)},c.prototype.disableMotor=function(){if(this.motorEnabled){var a=this.equations.indexOf(this.motorEquation);this.equations.splice(a,1),this.motorEnabled=!1}},c.prototype.motorIsEnabled=function(){return!!this.motorEnabled},c.prototype.setMotorSpeed=function(a){if(this.motorEnabled){var b=this.equations.indexOf(this.motorEquation);this.equations[b].relativeVelocity=a}},c.prototype.getMotorSpeed=function(){return this.motorEnabled?this.motorEquation.relativeVelocity:!1}},{"../equations/Equation":24,"../equations/RotationalLockEquation":26,"../equations/RotationalVelocityEquation":27,"../math/vec2":33,"./Constraint":16}],22:[function(a,b){function c(a,b,c){c=c||{},d.call(this,a,b,-Number.MAX_VALUE,Number.MAX_VALUE),this.angle=c.angle||0,this.ratio="number"==typeof c.ratio?c.ratio:1,this.setRatio(this.ratio)}var d=a("./Equation");a("../math/vec2"),b.exports=c,c.prototype=new d,c.prototype.constructor=c,c.prototype.computeGq=function(){return this.ratio*this.bi.angle-this.bj.angle+this.angle},c.prototype.setRatio=function(a){var b=this.G;b[2]=a,b[5]=-1,this.ratio=a}},{"../math/vec2":33,"./Equation":24}],23:[function(a,b){function c(a,b){d.call(this,a,b,0,Number.MAX_VALUE),this.ri=e.create(),this.penetrationVec=e.create(),this.rj=e.create(),this.ni=e.create(),this.restitution=0,this.firstImpact=!1,this.shapeA=null,this.shapeB=null}var d=a("./Equation"),e=a("../math/vec2");a("../math/mat2"),b.exports=c,c.prototype=new d,c.prototype.constructor=c,c.prototype.computeB=function(a,b,c){var d=this.bi,f=this.bj,g=this.ri,h=this.rj,i=d.position,j=f.position,k=this.penetrationVec,l=this.ni,m=this.G,n=e.crossLength(g,l),o=e.crossLength(h,l);m[0]=-l[0],m[1]=-l[1],m[2]=-n,m[3]=l[0],m[4]=l[1],m[5]=o,e.add(k,j,h),e.sub(k,k,i),e.sub(k,k,g);var p,q;this.firstImpact&&0!==this.restitution?(q=0,p=1/b*(1+this.restitution)*this.computeGW()):(p=this.computeGW(),q=e.dot(l,k));var r=this.computeGiMf(),s=-q*a-p*b-c*r;return s}},{"../math/mat2":31,"../math/vec2":33,"./Equation":24}],24:[function(a,b){function c(a,b,c,d){this.minForce="undefined"==typeof c?-1e6:c,this.maxForce="undefined"==typeof d?1e6:d,this.bi=a,this.bj=b,this.stiffness=1e6,this.relaxation=4,this.G=new g.ARRAY_TYPE(6),this.offset=0,this.a=0,this.b=0,this.eps=0,this.h=0,this.updateSpookParams(1/60),this.multiplier=0}function d(a,b,c,d,e){return a[0]*b[0]+a[1]*b[1]+a[2]*c+a[3]*d[0]+a[4]*d[1]+a[5]*e}b.exports=c;var e=a("../math/vec2"),f=a("../math/mat2"),g=a("../utils/Utils");c.prototype.constructor=c,c.prototype.updateSpookParams=function(a){var b=this.stiffness,c=this.relaxation,d=a;this.a=4/(d*(1+4*c)),this.b=4*c/(1+4*c),this.eps=4/(d*d*b*(1+4*c)),this.h=a},c.prototype.computeB=function(a,b,c){var d=this.computeGW(),e=this.computeGq(),f=this.computeGiMf();return-e*a-d*b-f*c};var h=e.create(),i=e.create();c.prototype.computeGq=function(){var a=this.G,b=this.bi,c=this.bj,e=(b.position,c.position,b.angle),f=c.angle;return d(a,h,e,i,f)+this.offset},e.create(),e.create(),c.prototype.transformedGmult=function(a,b,c,e,f){return d(a,b,c,e,f)},c.prototype.computeGW=function(){var a=this.G,b=this.bi,c=this.bj,d=b.velocity,e=c.velocity,f=b.angularVelocity,g=c.angularVelocity;return this.transformedGmult(a,d,f,e,g)},c.prototype.computeGWlambda=function(){var a=this.G,b=this.bi,c=this.bj,e=b.vlambda,f=c.vlambda,g=b.wlambda,h=c.wlambda;return d(a,e,g,f,h)};var j=e.create(),k=e.create();c.prototype.computeGiMf=function(){var a=this.bi,b=this.bj,c=a.force,d=a.angularForce,f=b.force,g=b.angularForce,h=a.invMass,i=b.invMass,l=a.invInertia,m=b.invInertia,n=this.G;return e.scale(j,c,h),e.scale(k,f,i),this.transformedGmult(n,j,d*l,k,g*m)},c.prototype.computeGiMGt=function(){var a=this.bi,b=this.bj,c=a.invMass,d=b.invMass,e=a.invInertia,f=b.invInertia,g=this.G;return g[0]*g[0]*c+g[1]*g[1]*c+g[2]*g[2]*e+g[3]*g[3]*d+g[4]*g[4]*d+g[5]*g[5]*f};{var l=e.create(),m=e.create(),n=e.create();e.create(),e.create(),e.create(),f.create(),f.create()}c.prototype.addToWlambda=function(a){var b=this.bi,c=this.bj,d=l,f=m,g=n,h=this.G;f[0]=h[0],f[1]=h[1],g[0]=h[3],g[1]=h[4],e.scale(d,f,b.invMass*a),e.add(b.vlambda,b.vlambda,d),e.scale(d,g,c.invMass*a),e.add(c.vlambda,c.vlambda,d),b.wlambda+=b.invInertia*h[2]*a,c.wlambda+=c.invInertia*h[5]*a},c.prototype.computeInvC=function(a){return 1/(this.computeGiMGt()+a)}},{"../math/mat2":31,"../math/vec2":33,"../utils/Utils":49}],25:[function(a,b){function c(a,b,c){e.call(this,a,b,-c,c),this.ri=d.create(),this.rj=d.create(),this.t=d.create(),this.contactEquation=null,this.shapeA=null,this.shapeB=null,this.frictionCoefficient=.3}var d=(a("../math/mat2"),a("../math/vec2")),e=a("./Equation");a("../utils/Utils"),b.exports=c,c.prototype=new e,c.prototype.constructor=c,c.prototype.setSlipForce=function(a){this.maxForce=a,this.minForce=-a},c.prototype.computeB=function(a,b,c){var e=(this.bi,this.bj,this.ri),f=this.rj,g=this.t,h=this.G;h[0]=-g[0],h[1]=-g[1],h[2]=-d.crossLength(e,g),h[3]=g[0],h[4]=g[1],h[5]=d.crossLength(f,g);var i=this.computeGW(),j=this.computeGiMf(),k=-i*b-c*j;return k}},{"../math/mat2":31,"../math/vec2":33,"../utils/Utils":49,"./Equation":24}],26:[function(a,b){function c(a,b,c){c=c||{},d.call(this,a,b,-Number.MAX_VALUE,Number.MAX_VALUE),this.angle=c.angle||0;var e=this.G;e[2]=1,e[5]=-1}var d=a("./Equation"),e=a("../math/vec2");b.exports=c,c.prototype=new d,c.prototype.constructor=c;var f=e.create(),g=e.create(),h=e.fromValues(1,0),i=e.fromValues(0,1);c.prototype.computeGq=function(){return e.rotate(f,h,this.bi.angle+this.angle),e.rotate(g,i,this.bj.angle),e.dot(f,g)}},{"../math/vec2":33,"./Equation":24}],27:[function(a,b){function c(a,b){d.call(this,a,b,-Number.MAX_VALUE,Number.MAX_VALUE),this.relativeVelocity=1,this.ratio=1}var d=a("./Equation");a("../math/vec2"),b.exports=c,c.prototype=new d,c.prototype.constructor=c,c.prototype.computeB=function(a,b,c){var d=this.G;d[2]=-1,d[5]=this.ratio;var e=this.computeGiMf(),f=this.computeGW()+this.relativeVelocity,g=-f*b-c*e;return g}},{"../math/vec2":33,"./Equation":24}],28:[function(a,b){var c=function(){};b.exports=c,c.prototype={constructor:c,on:function(a,b){void 0===this._listeners&&(this._listeners={});var c=this._listeners;return void 0===c[a]&&(c[a]=[]),-1===c[a].indexOf(b)&&c[a].push(b),this},has:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},off:function(a,b){if(void 0===this._listeners)return this;var c=this._listeners,d=c[a].indexOf(b);return-1!==d&&c[a].splice(d,1),this},emit:function(a){if(void 0===this._listeners)return this;var b=this._listeners,c=b[a.type];if(void 0!==c){a.target=this;for(var d=0,e=c.length;e>d;d++)c[d].call(this,a)}return this}}},{}],29:[function(a,b){function c(a,b,c){c=c||{},this.id=d++,this.materialA=a,this.materialB=b,this.friction="undefined"!=typeof c.friction?Number(c.friction):.3,this.restitution="undefined"!=typeof c.restitution?Number(c.restitution):0,this.stiffness="undefined"!=typeof c.stiffness?Number(c.stiffness):1e7,this.relaxation="undefined"!=typeof c.relaxation?Number(c.relaxation):3,this.frictionStiffness="undefined"!=typeof c.frictionStiffness?Number(c.frictionStiffness):1e7,this.frictionRelaxation="undefined"!=typeof c.frictionRelaxation?Number(c.frictionRelaxation):3}b.exports=c;var d=0},{}],30:[function(a,b){function c(){this.id=d++}b.exports=c;var d=0},{}],31:[function(a,b){var c=a("../../node_modules/gl-matrix/src/gl-matrix/mat2").mat2;b.exports=c},{"../../node_modules/gl-matrix/src/gl-matrix/mat2":1}],32:[function(a,b){var c={};c.GetArea=function(a){if(a.length<6)return 0;for(var b=a.length-2,c=0,d=0;b>d;d+=2)c+=(a[d+2]-a[d])*(a[d+1]+a[d+3]);return c+=(a[0]-a[b])*(a[b+1]+a[1]),.5*-c},c.Triangulate=function(a){var b=a.length>>1;if(3>b)return[];for(var d=[],e=[],f=0;b>f;f++)e.push(f);for(var f=0,g=b;g>3;){var h=e[(f+0)%g],i=e[(f+1)%g],j=e[(f+2)%g],k=a[2*h],l=a[2*h+1],m=a[2*i],n=a[2*i+1],o=a[2*j],p=a[2*j+1],q=!1;if(c._convex(k,l,m,n,o,p)){q=!0;for(var r=0;g>r;r++){var s=e[r];if(s!=h&&s!=i&&s!=j&&c._PointInTriangle(a[2*s],a[2*s+1],k,l,m,n,o,p)){q=!1;break}}}if(q)d.push(h,i,j),e.splice((f+1)%g,1),g--,f=0;else if(f++>3*g)break}return d.push(e[0],e[1],e[2]),d},c._PointInTriangle=function(a,b,c,d,e,f,g,h){var i=g-c,j=h-d,k=e-c,l=f-d,m=a-c,n=b-d,o=i*i+j*j,p=i*k+j*l,q=i*m+j*n,r=k*k+l*l,s=k*m+l*n,t=1/(o*r-p*p),u=(r*q-p*s)*t,v=(o*s-p*q)*t;return u>=0&&v>=0&&1>u+v},c._convex=function(a,b,c,d,e,f){return(b-d)*(e-c)+(c-a)*(f-d)>=0},b.exports=c},{}],33:[function(a,b){var c=a("../../node_modules/gl-matrix/src/gl-matrix/vec2").vec2;c.getX=function(a){return a[0]},c.getY=function(a){return a[1]},c.crossLength=function(a,b){return a[0]*b[1]-a[1]*b[0]},c.crossVZ=function(a,b,d){return c.rotate(a,b,-Math.PI/2),c.scale(a,a,d),a},c.crossZV=function(a,b,d){return c.rotate(a,d,Math.PI/2),c.scale(a,a,b),a},c.rotate=function(a,b,c){var d=Math.cos(c),e=Math.sin(c),f=b[0],g=b[1];a[0]=d*f-e*g,a[1]=e*f+d*g},c.toLocalFrame=function(a,b,d,e){c.copy(a,b),c.sub(a,a,d),c.rotate(a,a,-e)},c.toGlobalFrame=function(a,b,d,e){c.copy(a,b),c.rotate(a,a,e),c.add(a,a,d)},c.centroid=function(a,b,d,e){return c.add(a,b,d),c.add(a,a,e),c.scale(a,a,1/3),a},b.exports=c},{"../../node_modules/gl-matrix/src/gl-matrix/vec2":2}],34:[function(a,b){function c(a){a=a||{},h.call(this),this.id=++c._idCounter,this.world=null,this.shapes=[],this.shapeOffsets=[],this.shapeAngles=[],this.mass=a.mass||0,this.invMass=0,this.inertia=0,this.invInertia=0,this.fixedRotation=!!a.fixedRotation||!1,this.updateMassProperties(),this.position=d.fromValues(0,0),a.position&&d.copy(this.position,a.position),this.interpolatedPosition=d.fromValues(0,0),this.velocity=d.fromValues(0,0),a.velocity&&d.copy(this.velocity,a.velocity),this.vlambda=d.fromValues(0,0),this.wlambda=0,this.angle=a.angle||0,this.angularVelocity=a.angularVelocity||0,this.force=d.create(),a.force&&d.copy(this.force,a.force),this.angularForce=a.angularForce||0,this.damping="number"==typeof a.damping?a.damping:.1,this.angularDamping="number"==typeof a.angularDamping?a.angularDamping:.1,this.motionState=0==this.mass?c.STATIC:c.DYNAMIC,this.boundingRadius=0,this.aabb=new g,this.aabbNeedsUpdate=!0,this.allowSleep=!1,this.sleepState=c.AWAKE,this.sleepSpeedLimit=.1,this.sleepTimeLimit=1,this.timeLastSleepy=0,this.concavePath=null,this.lastDampingScale=1,this.lastAngularDampingScale=1,this.lastDampingTimeStep=-1}var d=a("../math/vec2"),e=a("poly-decomp"),f=a("../shapes/Convex"),g=a("../collision/AABB"),h=a("../events/EventEmitter");b.exports=c,c.prototype=new h,c._idCounter=0,c.prototype.setDensity=function(a){var b=this.getArea();this.mass=b*a,this.updateMassProperties()},c.prototype.getArea=function(){for(var a=0,b=0;be&&(e=h+i)}this.boundingRadius=e},c.prototype.addShape=function(a,b,c){c=c||0,b=b?d.fromValues(b[0],b[1]):d.fromValues(0,0),this.shapes.push(a),this.shapeOffsets.push(b),this.shapeAngles.push(c),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0},c.prototype.removeShape=function(a){var b=this.shapes.indexOf(a);return-1!=b?(this.shapes.splice(b,1),this.shapeOffsets.splice(b,1),this.shapeAngles.splice(b,1),this.aabbNeedsUpdate=!0,!0):!1},c.prototype.updateMassProperties=function(){var a=this.shapes,b=a.length,c=this.mass/b,e=0;if(!this.fixedRotation)for(var f=0;b>f;f++){var g=a[f],h=d.squaredLength(this.shapeOffsets[f]),i=g.computeMomentOfInertia(c);e+=i+c*h}this.inertia=e,this.invMass=this.mass>0?1/this.mass:0,this.invInertia=e>0?1/e:0};var k=d.create();c.prototype.applyForce=function(a,b){var c=k;d.sub(c,b,this.position),d.add(this.force,this.force,a);var e=d.crossLength(c,a);this.angularForce+=e},c.prototype.toLocalFrame=function(a,b){d.toLocalFrame(a,b,this.position,this.angle)},c.prototype.toWorldFrame=function(a,b){d.toGlobalFrame(a,b,this.position,this.angle)},c.prototype.fromPolygon=function(a,b){b=b||{};for(var c=this.shapes.length;c>=0;--c)this.removeShape(this.shapes[c]);var g=new e.Polygon;if(g.vertices=a,g.makeCCW(),"number"==typeof b.removeCollinearPoints&&g.removeCollinearPoints(b.removeCollinearPoints),"undefined"==typeof b.skipSimpleCheck&&!g.isSimple())return!1;this.concavePath=g.vertices.slice(0);for(var c=0;ce?(this.sleepState=c.SLEEPY,this.timeLastSleepy=a,this.emit(c.sleepyEvent)):b===c.SLEEPY&&e>f?this.wakeUp():b===c.SLEEPY&&a-this.timeLastSleepy>this.sleepTimeLimit&&this.sleep()}},c.sleepyEvent={type:"sleepy"},c.sleepEvent={type:"sleep"},c.wakeUpEvent={type:"wakeup"},c.DYNAMIC=1,c.STATIC=2,c.KINEMATIC=4,c.AWAKE=0,c.SLEEPY=1,c.SLEEPING=2},{"../collision/AABB":9,"../events/EventEmitter":28,"../math/vec2":33,"../shapes/Convex":39,"poly-decomp":7}],35:[function(a,b){function c(a,b,c){c=c||{},this.restLength="number"==typeof c.restLength?c.restLength:1,this.stiffness=c.stiffness||100,this.damping=c.damping||1,this.bodyA=a,this.bodyB=b,this.localAnchorA=d.fromValues(0,0),this.localAnchorB=d.fromValues(0,0),c.localAnchorA&&d.copy(this.localAnchorA,c.localAnchorA),c.localAnchorB&&d.copy(this.localAnchorB,c.localAnchorB),c.worldAnchorA&&this.setWorldAnchorA(c.worldAnchorA),c.worldAnchorB&&this.setWorldAnchorB(c.worldAnchorB)}var d=a("../math/vec2");b.exports=c,c.prototype.setWorldAnchorA=function(a){this.bodyA.toLocalFrame(this.localAnchorA,a)},c.prototype.setWorldAnchorB=function(a){this.bodyB.toLocalFrame(this.localAnchorB,a)},c.prototype.getWorldAnchorA=function(a){this.bodyA.toWorldFrame(a,this.localAnchorA)},c.prototype.getWorldAnchorB=function(a){this.bodyB.toWorldFrame(a,this.localAnchorB)};var e=d.create(),f=d.create(),g=d.create(),h=d.create(),i=d.create(),j=d.create(),k=d.create(),l=d.create(),m=d.create();c.prototype.applyForce=function(){var a=this.stiffness,b=this.damping,c=this.restLength,n=this.bodyA,o=this.bodyB,p=e,q=f,r=g,s=h,t=m,u=i,v=j,w=k,x=l;this.getWorldAnchorA(u),this.getWorldAnchorB(v),d.sub(w,u,n.position),d.sub(x,v,o.position),d.sub(p,v,u);var y=d.len(p);d.normalize(q,p),d.sub(r,o.velocity,n.velocity),d.crossZV(t,o.angularVelocity,x),d.add(r,r,t),d.crossZV(t,n.angularVelocity,w),d.sub(r,r,t),d.scale(s,q,-a*(y-c)-b*d.dot(r,q)),d.sub(n.force,n.force,s),d.add(o.force,o.force,s);var z=d.crossLength(w,s),A=d.crossLength(x,s);n.angularForce-=z,o.angularForce+=A}},{"../math/vec2":33}],36:[function(a,b){b.exports={AABB:a("./collision/AABB"),AngleLockEquation:a("./equations/AngleLockEquation"),Body:a("./objects/Body"),Broadphase:a("./collision/Broadphase"),Capsule:a("./shapes/Capsule"),Circle:a("./shapes/Circle"),Constraint:a("./constraints/Constraint"),ContactEquation:a("./equations/ContactEquation"),ContactMaterial:a("./material/ContactMaterial"),Convex:a("./shapes/Convex"),DistanceConstraint:a("./constraints/DistanceConstraint"),Equation:a("./equations/Equation"),EventEmitter:a("./events/EventEmitter"),FrictionEquation:a("./equations/FrictionEquation"),GearConstraint:a("./constraints/GearConstraint"),GridBroadphase:a("./collision/GridBroadphase"),GSSolver:a("./solver/GSSolver"),Island:a("./solver/IslandSolver"),IslandSolver:a("./solver/IslandSolver"),Line:a("./shapes/Line"),LockConstraint:a("./constraints/LockConstraint"),Material:a("./material/Material"),NaiveBroadphase:a("./collision/NaiveBroadphase"),Particle:a("./shapes/Particle"),Plane:a("./shapes/Plane"),RevoluteConstraint:a("./constraints/RevoluteConstraint"),PrismaticConstraint:a("./constraints/PrismaticConstraint"),Rectangle:a("./shapes/Rectangle"),RotationalVelocityEquation:a("./equations/RotationalVelocityEquation"),SAP1DBroadphase:a("./collision/SAP1DBroadphase"),Shape:a("./shapes/Shape"),Solver:a("./solver/Solver"),Spring:a("./objects/Spring"),Utils:a("./utils/Utils"),World:a("./world/World"),QuadTree:a("./collision/QuadTree").QuadTree,vec2:a("./math/vec2"),version:a("../package.json").version}},{"../package.json":8,"./collision/AABB":9,"./collision/Broadphase":10,"./collision/GridBroadphase":11,"./collision/NaiveBroadphase":12,"./collision/QuadTree":14,"./collision/SAP1DBroadphase":15,"./constraints/Constraint":16,"./constraints/DistanceConstraint":17,"./constraints/GearConstraint":18,"./constraints/LockConstraint":19,"./constraints/PrismaticConstraint":20,"./constraints/RevoluteConstraint":21,"./equations/AngleLockEquation":22,"./equations/ContactEquation":23,"./equations/Equation":24,"./equations/FrictionEquation":25,"./equations/RotationalVelocityEquation":27,"./events/EventEmitter":28,"./material/ContactMaterial":29,"./material/Material":30,"./math/vec2":33,"./objects/Body":34,"./objects/Spring":35,"./shapes/Capsule":37,"./shapes/Circle":38,"./shapes/Convex":39,"./shapes/Line":40,"./shapes/Particle":41,"./shapes/Plane":42,"./shapes/Rectangle":43,"./shapes/Shape":44,"./solver/GSSolver":45,"./solver/IslandSolver":47,"./solver/Solver":48,"./utils/Utils":49,"./world/World":50}],37:[function(a,b){function c(a,b){this.length=a||1,this.radius=b||1,d.call(this,d.CAPSULE)}var d=a("./Shape"),e=a("../math/vec2");b.exports=c,c.prototype=new d,c.prototype.computeMomentOfInertia=function(a){var b=this.radius,c=this.length+b,d=2*b;return a*(d*d+c*c)/12},c.prototype.updateBoundingRadius=function(){this.boundingRadius=this.radius+this.length/2},c.prototype.updateArea=function(){this.area=Math.PI*this.radius*this.radius+2*this.radius*this.length};var f=e.create();c.prototype.computeAABB=function(a,b,c){var d=this.radius;e.set(f,this.length,0),e.rotate(f,f,c),e.set(a.upperBound,Math.max(f[0]+d,-f[0]+d),Math.max(f[1]+d,-f[1]+d)),e.set(a.lowerBound,Math.min(f[0]-d,-f[0]-d),Math.min(f[1]-d,-f[1]-d)),e.add(a.lowerBound,a.lowerBound,b),e.add(a.upperBound,a.upperBound,b)}},{"../math/vec2":33,"./Shape":44}],38:[function(a,b){function c(a){this.radius=a||1,d.call(this,d.CIRCLE) -}var d=a("./Shape"),e=a("../math/vec2");b.exports=c,c.prototype=new d,c.prototype.computeMomentOfInertia=function(a){var b=this.radius;return a*b*b/2},c.prototype.updateBoundingRadius=function(){this.boundingRadius=this.radius},c.prototype.updateArea=function(){this.area=Math.PI*this.radius*this.radius},c.prototype.computeAABB=function(a,b){var c=this.radius;e.set(a.upperBound,c,c),e.set(a.lowerBound,-c,-c),b&&(e.add(a.lowerBound,a.lowerBound,b),e.add(a.upperBound,a.upperBound,b))}},{"../math/vec2":33,"./Shape":44}],39:[function(a,b){function c(a){this.vertices=a||[];for(var b=0;bg;f=g,g++){var h=this.vertices[f],i=this.vertices[g],j=Math.abs(e.crossLength(h,i)),k=e.dot(i,i)+e.dot(i,h)+e.dot(h,h);b+=j*k,c+=j}return a/6*(b/c)},c.prototype.updateBoundingRadius=function(){for(var a=this.vertices,b=0,c=0;c!==a.length;c++){var d=e.squaredLength(a[c]);d>b&&(b=d)}this.boundingRadius=Math.sqrt(b)},c.triangleArea=function(a,b,c){return.5*((b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1]))},c.prototype.updateArea=function(){this.updateTriangles(),this.area=0;for(var a=this.triangles,b=this.vertices,d=0;d!==a.length;d++){var e=a[d],f=b[e[0]],g=b[e[1]],h=b[e[2]],i=c.triangleArea(f,g,h);this.area+=i}},c.prototype.computeAABB=function(a,b,c){a.setFromPoints(this.vertices,b,c)}},{"../math/polyk":32,"../math/vec2":33,"./Shape":44,"poly-decomp":7}],40:[function(a,b){function c(a){this.length=a,d.call(this,d.LINE)}var d=a("./Shape"),e=a("../math/vec2");b.exports=c,c.prototype=new d,c.prototype.computeMomentOfInertia=function(a){return a*Math.pow(this.length,2)/12},c.prototype.updateBoundingRadius=function(){this.boundingRadius=this.length/2};var f=[e.create(),e.create()];c.prototype.computeAABB=function(a,b,c){var d=this.length;e.set(f[0],-d/2,0),e.set(f[1],d/2,0),a.setFromPoints(f,b,c)}},{"../math/vec2":33,"./Shape":44}],41:[function(a,b){function c(){d.call(this,d.PARTICLE)}var d=a("./Shape");b.exports=c,c.prototype=new d,c.prototype.computeMomentOfInertia=function(){return 0},c.prototype.updateBoundingRadius=function(){this.boundingRadius=0},c.prototype.computeAABB=function(a,b){this.length,vec2.copy(a.lowerBound,b),vec2.copy(a.upperBound,b)}},{"./Shape":44}],42:[function(a,b){function c(){d.call(this,d.PLANE)}var d=a("./Shape"),e=a("../math/vec2");a("../utils/Utils"),b.exports=c,c.prototype=new d,c.prototype.computeMomentOfInertia=function(){return 0},c.prototype.updateBoundingRadius=function(){this.boundingRadius=Number.MAX_VALUE},c.prototype.computeAABB=function(a,b,c){var d=0,f=e.set;"number"==typeof c&&(d=c%(2*Math.PI)),0==d?(f(a.lowerBound,-Number.MAX_VALUE,-Number.MAX_VALUE),f(a.upperBound,Number.MAX_VALUE,0)):d==Math.PI/2?(f(a.lowerBound,0,-Number.MAX_VALUE),f(a.upperBound,Number.MAX_VALUE,Number.MAX_VALUE)):d==Math.PI?(f(a.lowerBound,-Number.MAX_VALUE,0),f(a.upperBound,Number.MAX_VALUE,Number.MAX_VALUE)):d==3*Math.PI/2?(f(a.lowerBound,-Number.MAX_VALUE,-Number.MAX_VALUE),f(a.upperBound,0,Number.MAX_VALUE)):(f(a.lowerBound,-Number.MAX_VALUE,-Number.MAX_VALUE),f(a.upperBound,Number.MAX_VALUE,Number.MAX_VALUE)),e.add(a.lowerBound,a.lowerBound,b),e.add(a.upperBound,a.upperBound,b)},c.prototype.updateArea=function(){this.area=Number.MAX_VALUE}},{"../math/vec2":33,"../utils/Utils":49,"./Shape":44}],43:[function(a,b){function c(a,b){var c=[d.fromValues(-a/2,-b/2),d.fromValues(a/2,-b/2),d.fromValues(a/2,b/2),d.fromValues(-a/2,b/2)];this.width=a,this.height=b,e.call(this,c)}var d=a("../math/vec2"),e=(a("./Shape"),a("./Convex"));b.exports=c,c.prototype=new e,c.prototype.computeMomentOfInertia=function(a){var b=this.width,c=this.height;return a*(c*c+b*b)/12},c.prototype.updateBoundingRadius=function(){var a=this.width,b=this.height;this.boundingRadius=Math.sqrt(a*a+b*b)/2},d.create(),d.create(),d.create(),d.create(),c.prototype.computeAABB=function(a,b,c){a.setFromPoints(this.vertices,b,c)},c.prototype.updateArea=function(){this.area=this.width*this.height}},{"../math/vec2":33,"./Convex":39,"./Shape":44}],44:[function(a,b){function c(a){this.type=a,this.id=c.idCounter++,this.boundingRadius=0,this.collisionGroup=1,this.collisionMask=1,a&&this.updateBoundingRadius(),this.material=null,this.area=0,this.updateArea()}b.exports=c,c.idCounter=0,c.CIRCLE=1,c.PARTICLE=2,c.PLANE=4,c.CONVEX=8,c.LINE=16,c.RECTANGLE=32,c.CAPSULE=64,c.prototype.computeMomentOfInertia=function(){throw new Error("Shape.computeMomentOfInertia is not implemented in this Shape...")},c.prototype.updateBoundingRadius=function(){throw new Error("Shape.updateBoundingRadius is not implemented in this Shape...")},c.prototype.updateArea=function(){},c.prototype.computeAABB=function(){}},{}],45:[function(a,b){function c(a){f.call(this,a),a=a||{},this.iterations=a.iterations||10,this.tolerance=a.tolerance||0,this.debug=a.debug||!1,this.arrayStep=30,this.lambda=new g.ARRAY_TYPE(this.arrayStep),this.Bs=new g.ARRAY_TYPE(this.arrayStep),this.invCs=new g.ARRAY_TYPE(this.arrayStep),this.useGlobalEquationParameters=!0,this.stiffness=1e6,this.relaxation=4,this.useZeroRHS=!1,this.skipFrictionIterations=0}function d(a){for(var b=0;b!==a.length;b++)a[b]=0}var e=a("../math/vec2"),f=a("./Solver"),g=a("../utils/Utils"),h=a("../equations/FrictionEquation");b.exports=c,c.prototype=new f,c.prototype.solve=function(a,b){this.sortEquations();var f=0,i=this.iterations,j=this.skipFrictionIterations,k=this.tolerance*this.tolerance,l=this.equations,m=l.length,n=b.bodies,o=b.bodies.length,p=this.relaxation,q=this.stiffness,r=4/(a*a*q*(1+4*p)),s=4/(a*(1+4*p)),t=4*p/(1+4*p),u=this.useGlobalEquationParameters,v=(e.add,e.set,this.useZeroRHS),w=this.lambda;w.lengthf)){var D=u?r:z.eps,E=c.iterateEquation(C,z,D,y,x,w,v,a);B+=Math.abs(E)}if(k>=B*B)break}for(A=0;A!==o;A++)n[A].addConstraintVelocity()}},c.iterateEquation=function(a,b,c,d,e,f,g,i){var j=d[a],k=e[a],l=f[a],m=b.computeGWlambda(c);b instanceof h&&(b.maxForce=b.contactEquation.multiplier*b.frictionCoefficient*i,b.minForce=-b.contactEquation.multiplier*b.frictionCoefficient*i);var n=b.maxForce,o=b.minForce;g&&(j=0);var p=k*(j-m-c*l),q=l+p;return o>q?p=o-l:q>n&&(p=n-l),f[a]+=p,b.multiplier=f[a]/i,b.addToWlambda(p),p}},{"../equations/FrictionEquation":25,"../math/vec2":33,"../utils/Utils":49,"./Solver":48}],46:[function(a,b){function c(){this.equations=[],this.bodies=[]}b.exports=c,c.prototype.reset=function(){this.equations.length=this.bodies.length=0},c.prototype.getBodies=function(){for(var a=[],b=[],c=this.equations,d=0;d!==c.length;d++){var e=c[d];-1===b.indexOf(e.bi.id)&&(a.push(e.bi),b.push(e.bi.id)),-1===b.indexOf(e.bj.id)&&(a.push(e.bj),b.push(e.bj.id))}return a},c.prototype.solve=function(a,b){var c=[];b.removeAllEquations();for(var d=this.equations.length,e=0;e!==d;e++)b.addEquation(this.equations[e]);for(var f=this.getBodies(),g=f.length,e=0;e!==g;e++)c.push(f[e]);b.solve(a,{bodies:c})}},{}],47:[function(a,b){function c(a,b){g.call(this,b),this.subsolver=a,this.numIslands=0,this._nodePool=[],this._islandPool=[],this.beforeSolveIslandEvent={type:"beforeSolveIsland",island:null}}function d(a){for(var b=a.length,c=0;c!==b;c++){var d=a[c];if(!(d.visited||d.body.motionState&j))return d}return!1}function e(a,b,c){b.push(a.body);for(var d=a.eqs.length,e=0;e!==d;e++){var f=a.eqs[e];-1===c.indexOf(f)&&c.push(f)}}function f(a,b,c,e){for(k.length=0,k.push(a),a.visited=!0,b(a,c,e);k.length;)for(var f,g=k.pop();f=d(g.children);)f.visited=!0,b(f,c,e),k.push(f)}var g=a("./Solver"),h=(a("../math/vec2"),a("../solver/Island")),i=a("../objects/Body"),j=i.STATIC;b.exports=c,c.prototype=new g;var k=[],l=[],m=[],n=[],o=[];c.prototype.solve=function(a,b){var c=l,g=b.bodies,i=this.equations,j=i.length,k=g.length,p=(this.subsolver,this._workers,this._workerData,this._workerIslandGroups,this._islandPool);l.length=0;for(var q=0;q!==k;q++)this._nodePool.length?c.push(this._nodePool.pop()):c.push({body:g[q],children:[],eqs:[],visited:!1});for(var q=0;q!==k;q++){var r=c[q];r.body=g[q],r.children.length=0,r.eqs.length=0,r.visited=!1}for(var s=0;s!==j;s++){var t=i[s],q=g.indexOf(t.bi),u=g.indexOf(t.bj),v=c[q],w=c[u];v.children.push(w),v.eqs.push(t),w.children.push(v),w.eqs.push(t)}var x,y=0,z=m,A=n;z.length=0,A.length=0;var B=o;for(B.length=0;x=d(c);){var C=p.length?p.pop():new h;z.length=0,A.length=0,f(x,e,A,z);for(var D=z.length,q=0;q!==D;q++){var t=z[q];C.equations.push(t)}y++,B.push(C)}this.numIslands=y;for(var E=this.beforeSolveIslandEvent,q=0;qd;d++)a[d]=a[d+c];a.length=e},c.ARRAY_TYPE=Float32Array||Array},{}],50:[function(a,b){function c(a){n.apply(this),a=a||{},this.springs=[],this.bodies=[],this.solver=a.solver||new d,this.narrowphase=new x(this),this.gravity=a.gravity||f.fromValues(0,-9.78),this.doProfiling=a.doProfiling||!1,this.lastStepTime=0,this.broadphase=a.broadphase||new e,this.broadphase.setWorld(this),this.constraints=[],this.defaultFriction=.3,this.defaultRestitution=0,this.lastTimeStep=1/60,this.applySpringForces=!0,this.applyDamping=!0,this.applyGravity=!0,this.solveConstraints=!0,this.contactMaterials=[],this.time=0,this.fixedStepTime=0,this.emitImpactEvent=!0,this.emitSeparationEvent=!0,this._constraintIdCounter=0,this._bodyIdCounter=0,this.postStepEvent={type:"postStep"},this.addBodyEvent={type:"addBody",body:null},this.removeBodyEvent={type:"removeBody",body:null},this.addSpringEvent={type:"addSpring",spring:null},this.impactEvent={type:"impact",bodyA:null,bodyB:null,shapeA:null,shapeB:null,contactEquation:null},this.separationEvent={type:"separation",bodyA:null,bodyB:null},this.postBroadphaseEvent={type:"postBroadphase",pairs:null},this.enableBodySleeping=!1,this.beginContactEvent={type:"beginContact",shapeA:null,shapeB:null,bodyA:null,bodyB:null},this.endContactEvent={type:"endContact",shapeA:null,shapeB:null},this.overlappingShapesLastState={keys:[]},this.overlappingShapesCurrentState={keys:[]},this.overlappingShapeLookup={keys:[]}}var d=a("../solver/GSSolver"),e=a("../collision/NaiveBroadphase"),f=a("../math/vec2"),g=a("../shapes/Circle"),h=a("../shapes/Rectangle"),i=a("../shapes/Convex"),j=a("../shapes/Line"),k=a("../shapes/Plane"),l=a("../shapes/Capsule"),m=a("../shapes/Particle"),n=a("../events/EventEmitter"),o=a("../objects/Body"),p=a("../objects/Spring"),q=a("../material/Material"),r=a("../material/ContactMaterial"),s=a("../constraints/DistanceConstraint"),t=a("../constraints/LockConstraint"),u=a("../constraints/RevoluteConstraint"),v=a("../constraints/PrismaticConstraint"),w=a("../../package.json"),x=(a("../collision/Broadphase"),a("../collision/Narrowphase")),y=a("../utils/Utils");b.exports=c;var z=w.version.split(".").slice(0,2).join(".");if("undefined"==typeof performance&&(performance={}),!performance.now){var A=Date.now();performance.timing&&performance.timing.navigationStart&&(A=performance.timing.navigationStart),performance.now=function(){return Date.now()-A}}c.prototype=new Object(n.prototype),c.prototype.addConstraint=function(a){this.constraints.push(a)},c.prototype.addContactMaterial=function(a){this.contactMaterials.push(a)},c.prototype.removeContactMaterial=function(a){var b=this.contactMaterials.indexOf(a);-1!==b&&y.splice(this.contactMaterials,b,1)},c.prototype.getContactMaterial=function(a,b){for(var c=this.contactMaterials,d=0,e=c.length;d!==e;d++){var f=c[d];if(f.materialA===a&&f.materialB===b||f.materialA===b&&f.materialB===a)return f}return!1},c.prototype.removeConstraint=function(a){var b=this.constraints.indexOf(a);-1!==b&&y.splice(this.constraints,b,1)};var B=(f.create(),f.create(),f.create(),f.create(),f.create(),f.create(),f.create()),C=f.fromValues(0,0),D=f.fromValues(0,0);f.fromValues(0,0),c.prototype.step=function(a,b,c){if(c=c||10,b=b||0,0==b)this.internalStep(a),this.time+=a;else{var d=Math.floor((this.time+b)/a)-Math.floor(this.time/a);d=Math.min(d,c);for(var e=0;d>e;e++)this.internalStep(a);this.time+=b,this.fixedStepTime+=d*a;for(var f=this.time-this.fixedStepTime-a,g=0;g!==this.bodies.length;g++){var h=this.bodies[g];h.interpolatedPosition[0]=h.position[0]+h.velocity[0]*f,h.interpolatedPosition[1]=h.position[1]+h.velocity[1]*f}}},c.prototype.internalStep=function(a){var b,d,e=this,g=this.doProfiling,h=this.springs.length,i=this.springs,j=this.bodies,k=this.gravity,l=this.solver,m=this.bodies.length,n=this.broadphase,p=this.narrowphase,q=this.constraints,r=B,s=(f.scale,f.add);if(f.rotate,this.lastTimeStep=a,g&&(b=performance.now()),this.applyGravity)for(var t=0;t!==m;t++){var u=j[t],v=u.force;f.scale(r,k,u.mass),s(v,v,r)}if(this.applySpringForces)for(var t=0;t!==h;t++){var w=i[t];w.applyForce()}if(this.applyDamping)for(var t=0;t!==m;t++){var u=j[t];u.applyDamping(a)}var x=n.getCollisionPairs(this);this.postBroadphaseEvent.pairs=x,this.emit(this.postBroadphaseEvent),p.reset(this);for(var t=0,y=x.length;t!==y;t+=2)for(var z=x[t],A=x[t+1],C=0,D=z.shapes.length;C!==D;C++)for(var E=z.shapes[C],F=z.shapeOffsets[C],G=z.shapeAngles[C],H=0,I=A.shapes.length;H!==I;H++){var J=A.shapes[H],K=A.shapeOffsets[H],L=A.shapeAngles[H],M=this.defaultFriction,N=this.defaultRestitution;if(E.material&&J.material){var O=this.getContactMaterial(E.material,J.material);O&&(M=O.friction,N=O.restitution)}this.runNarrowphase(p,z,E,F,G,A,J,K,L,M,N)}for(var P=this.overlappingShapesLastState,t=0;t0&&c.integrateBody(V,a)}for(var t=0;t!==m;t++)j[t].setZeroForce();if(g&&(d=performance.now(),e.lastStepTime=d-b),this.emitImpactEvent)for(var W=this.impactEvent,t=0;t!==p.contactEquations.length;t++){var X=p.contactEquations[t];X.firstImpact&&(W.bodyA=X.bi,W.bodyB=X.bj,W.shapeA=X.shapeA,W.shapeB=X.shapeB,W.contactEquation=X,this.emit(W))}if(this.enableBodySleeping)for(t=0;t!==m;t++)j[t].sleepTick(this.time);this.emit(this.postStepEvent)};var E=f.create(),F=f.create();c.integrateBody=function(a,b){var c=a.invMass,d=a.force,e=a.position,g=a.velocity;a.fixedRotation||(a.angularVelocity+=a.angularForce*a.invInertia*b,a.angle+=a.angularVelocity*b),f.scale(E,d,b*c),f.add(g,E,g),f.scale(F,g,b),f.add(e,e,F),a.aabbNeedsUpdate=!0},c.prototype.runNarrowphase=function(a,b,c,d,e,g,h,i,j,k,l){if(0!==(c.collisionGroup&h.collisionMask)&&0!==(h.collisionGroup&c.collisionMask)){var m=b.invMass+g.invMass;m>0&&(m=1/m),f.rotate(C,d,b.angle),f.rotate(D,i,g.angle),f.add(C,C,b.position),f.add(D,D,g.position);var n=e+b.angle,o=j+g.angle;a.enableFriction=k>0,a.frictionCoefficient=k,a.restitution=l;var p=a[c.type|h.type],q=0;if(p&&(q=c.type0)){var r=c.id=0;b--)this.removeConstraint(a[b]);for(var c=this.bodies,b=c.length-1;b>=0;b--)this.removeBody(c[b]);for(var d=this.springs,b=d.length-1;b>=0;b--)this.removeSpring(d[b]);for(var e=this.contactMaterials,b=e.length-1;b>=0;b--)this.removeContactMaterial(e[b])},c.prototype.clone=function(){var a=new c;return a.fromJSON(this.toJSON()),a};var G=f.create(),H=f.fromValues(0,0),I=f.fromValues(0,0);c.prototype.hitTest=function(a,b,c){c=c||0;var d=new o({position:a}),e=new m,h=a,j=0,n=G,p=H,q=I;d.addShape(e);for(var r=this.narrowphase,s=[],t=0,u=b.length;t!==u;t++)for(var v=b[t],w=0,x=v.shapes.length;w!==x;w++){var y=v.shapes[w],z=v.shapeOffsets[w]||p,A=v.shapeAngles[w]||0;f.rotate(n,z,v.angle),f.add(n,n,v.position);var B=A+v.angle;(y instanceof g&&r.circleParticle(v,y,n,B,d,e,h,j,!0)||y instanceof i&&r.particleConvex(d,e,h,j,v,y,n,B,!0)||y instanceof k&&r.particlePlane(d,e,h,j,v,y,n,B,!0)||y instanceof l&&r.particleCapsule(d,e,h,j,v,y,n,B,!0)||y instanceof m&&f.squaredLength(f.sub(q,n,a))0;b--){var c=Math.floor(Math.random()*(b+1)),d=a[b];a[b]=a[c],a[c]=d}return a},pad:function(a,b,c,d){if("undefined"==typeof b)var b=0;if("undefined"==typeof c)var c=" ";if("undefined"==typeof d)var d=3;var e=0;if(b+1>=a.length)switch(d){case 1:a=Array(b+1-a.length).join(c)+a;break;case 3:var f=Math.ceil((e=b-a.length)/2),g=e-f;a=Array(g+1).join(c)+a+Array(f+1).join(c);break;default:a+=Array(b+1-a.length).join(c)}return a},isPlainObject:function(a){if("object"!=typeof a||a.nodeType||a===a.window)return!1;try{if(a.constructor&&!hasOwn.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(b){return!1}return!0},extend:function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;for("boolean"==typeof h&&(k=h,h=arguments[1]||{},i=2),j===i&&(h=this,--i);j>i;i++)if(null!=(a=arguments[i]))for(c in a)d=h[c],e=a[c],h!==e&&(k&&e&&(b.Utils.isPlainObject(e)||(f=Array.isArray(e)))?(f?(f=!1,g=d&&Array.isArray(d)?d:[]):g=d&&b.Utils.isPlainObject(d)?d:{},h[c]=b.Utils.extend(k,g,e)):void 0!==e&&(h[c]=e));return h}},a.hex2rgb=function(a){return[(255&a>>16)/255,(255&a>>8)/255,(255&a)/255]},a.rgb2hex=function(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]},a.canUseNewCanvasBlendModes=function(){var a=document.createElement("canvas");a.width=1,a.height=1;var b=a.getContext("2d");return b.fillStyle="#000",b.fillRect(0,0,1,1),b.globalCompositeOperation="multiply",b.fillStyle="#fff",b.fillRect(0,0,1,1),0===b.getImageData(0,0,1,1).data[0]},a.getNextPowerOfTwo=function(a){if(a>0&&0===(a&a-1))return a;for(var b=1;a>b;)b<<=1;return b},"function"!=typeof Function.prototype.bind&&(Function.prototype.bind=function(){var a=Array.prototype.slice;return function(b){function c(){var f=e.concat(a.call(arguments));d.apply(this instanceof c?this:b,f)}var d=this,e=a.call(arguments,1);if("function"!=typeof d)throw new TypeError;return c.prototype=function f(a){return a&&(f.prototype=a),this instanceof f?void 0:new f}(d.prototype),c}}()),Array.isArray||(Array.isArray=function(a){return"[object Array]"==Object.prototype.toString.call(a)}),b.Circle=function(a,b,c){a=a||0,b=b||0,c=c||0,this.x=a,this.y=b,this._diameter=c,this._radius=c>0?.5*c:0},b.Circle.prototype={circumference:function(){return 2*Math.PI*this._radius},setTo:function(a,b,c){return this.x=a,this.y=b,this._diameter=c,this._radius=.5*c,this},copyFrom:function(a){return this.setTo(a.x,a.y,a.diameter)},copyTo:function(a){return a.x=this.x,a.y=this.y,a.diameter=this._diameter,a},distance:function(a,c){return"undefined"==typeof c&&(c=!1),c?b.Math.distanceRound(this.x,this.y,a.x,a.y):b.Math.distance(this.x,this.y,a.x,a.y)},clone:function(a){return"undefined"==typeof a?a=new b.Circle(this.x,this.y,this.diameter):a.setTo(this.x,this.y,this.diameter),a},contains:function(a,c){return b.Circle.contains(this,a,c)},circumferencePoint:function(a,c,d){return b.Circle.circumferencePoint(this,a,c,d)},offset:function(a,b){return this.x+=a,this.y+=b,this},offsetPoint:function(a){return this.offset(a.x,a.y)},toString:function(){return"[{Phaser.Circle (x="+this.x+" y="+this.y+" diameter="+this.diameter+" radius="+this.radius+")}]"}},b.Circle.prototype.constructor=b.Circle,Object.defineProperty(b.Circle.prototype,"diameter",{get:function(){return this._diameter},set:function(a){a>0&&(this._diameter=a,this._radius=.5*a)}}),Object.defineProperty(b.Circle.prototype,"radius",{get:function(){return this._radius},set:function(a){a>0&&(this._radius=a,this._diameter=2*a)}}),Object.defineProperty(b.Circle.prototype,"left",{get:function(){return this.x-this._radius},set:function(a){a>this.x?(this._radius=0,this._diameter=0):this.radius=this.x-a}}),Object.defineProperty(b.Circle.prototype,"right",{get:function(){return this.x+this._radius},set:function(a){athis.y?(this._radius=0,this._diameter=0):this.radius=this.y-a}}),Object.defineProperty(b.Circle.prototype,"bottom",{get:function(){return this.y+this._radius},set:function(a){a0?Math.PI*this._radius*this._radius:0}}),Object.defineProperty(b.Circle.prototype,"empty",{get:function(){return 0===this._diameter},set:function(a){a===!0&&this.setTo(0,0,0)}}),b.Circle.contains=function(a,b,c){if(a.radius>0&&b>=a.left&&b<=a.right&&c>=a.top&&c<=a.bottom){var d=(a.x-b)*(a.x-b),e=(a.y-c)*(a.y-c); -return d+e<=a.radius*a.radius}return!1},b.Circle.equals=function(a,b){return a.x==b.x&&a.y==b.y&&a.diameter==b.diameter},b.Circle.intersects=function(a,c){return b.Math.distance(a.x,a.y,c.x,c.y)<=a.radius+c.radius},b.Circle.circumferencePoint=function(a,c,d,e){return"undefined"==typeof d&&(d=!1),"undefined"==typeof e&&(e=new b.Point),d===!0&&(c=b.Math.radToDeg(c)),e.x=a.x+a.radius*Math.cos(c),e.y=a.y+a.radius*Math.sin(c),e},b.Circle.intersectsRectangle=function(a,b){var c=Math.abs(a.x-b.x-b.halfWidth),d=b.halfWidth+a.radius;if(c>d)return!1;var e=Math.abs(a.y-b.y-b.halfHeight),f=b.halfHeight+a.radius;if(e>f)return!1;if(c<=b.halfWidth||e<=b.halfHeight)return!0;var g=c-b.halfWidth,h=e-b.halfHeight,i=g*g,j=h*h,k=a.radius*a.radius;return k>=i+j},a.Circle=b.Circle,b.Point=function(a,b){a=a||0,b=b||0,this.x=a,this.y=b},b.Point.prototype={copyFrom:function(a){return this.setTo(a.x,a.y)},invert:function(){return this.setTo(this.y,this.x)},setTo:function(a,b){return this.x=a||0,this.y=b||(0!==b?this.x:0),this},set:function(a,b){return this.x=a||0,this.y=b||(0!==b?this.x:0),this},add:function(a,b){return this.x+=a,this.y+=b,this},subtract:function(a,b){return this.x-=a,this.y-=b,this},multiply:function(a,b){return this.x*=a,this.y*=b,this},divide:function(a,b){return this.x/=a,this.y/=b,this},clampX:function(a,c){return this.x=b.Math.clamp(this.x,a,c),this},clampY:function(a,c){return this.y=b.Math.clamp(this.y,a,c),this},clamp:function(a,c){return this.x=b.Math.clamp(this.x,a,c),this.y=b.Math.clamp(this.y,a,c),this},clone:function(a){return"undefined"==typeof a?a=new b.Point(this.x,this.y):a.setTo(this.x,this.y),a},copyTo:function(a){return a.x=this.x,a.y=this.y,a},distance:function(a,c){return b.Point.distance(this,a,c)},equals:function(a){return a.x==this.x&&a.y==this.y},rotate:function(a,c,d,e,f){return b.Point.rotate(this,a,c,d,e,f)},getMagnitude:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},setMagnitude:function(a){return this.normalize().multiply(a,a)},normalize:function(){if(!this.isZero()){var a=this.getMagnitude();this.x/=a,this.y/=a}return this},isZero:function(){return 0===this.x&&0===this.y},toString:function(){return"[{Point (x="+this.x+" y="+this.y+")}]"}},b.Point.prototype.constructor=b.Point,b.Point.add=function(a,c,d){return"undefined"==typeof d&&(d=new b.Point),d.x=a.x+c.x,d.y=a.y+c.y,d},b.Point.subtract=function(a,c,d){return"undefined"==typeof d&&(d=new b.Point),d.x=a.x-c.x,d.y=a.y-c.y,d},b.Point.multiply=function(a,c,d){return"undefined"==typeof d&&(d=new b.Point),d.x=a.x*c.x,d.y=a.y*c.y,d},b.Point.divide=function(a,c,d){return"undefined"==typeof d&&(d=new b.Point),d.x=a.x/c.x,d.y=a.y/c.y,d},b.Point.equals=function(a,b){return a.x==b.x&&a.y==b.y},b.Point.distance=function(a,c,d){return"undefined"==typeof d&&(d=!1),d?b.Math.distanceRound(a.x,a.y,c.x,c.y):b.Math.distance(a.x,a.y,c.x,c.y)},b.Point.rotate=function(a,c,d,e,f,g){return f=f||!1,g=g||null,f&&(e=b.Math.degToRad(e)),null===g&&(g=Math.sqrt((c-a.x)*(c-a.x)+(d-a.y)*(d-a.y))),a.setTo(c+g*Math.cos(e),d+g*Math.sin(e))},a.Point=b.Point,b.Rectangle=function(a,b,c,d){a=a||0,b=b||0,c=c||0,d=d||0,this.x=a,this.y=b,this.width=c,this.height=d},b.Rectangle.prototype={offset:function(a,b){return this.x+=a,this.y+=b,this},offsetPoint:function(a){return this.offset(a.x,a.y)},setTo:function(a,b,c,d){return this.x=a,this.y=b,this.width=c,this.height=d,this},floor:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y)},floorAll:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.width=Math.floor(this.width),this.height=Math.floor(this.height)},copyFrom:function(a){return this.setTo(a.x,a.y,a.width,a.height)},copyTo:function(a){return a.x=this.x,a.y=this.y,a.width=this.width,a.height=this.height,a},inflate:function(a,c){return b.Rectangle.inflate(this,a,c)},size:function(a){return b.Rectangle.size(this,a)},clone:function(a){return b.Rectangle.clone(this,a)},contains:function(a,c){return b.Rectangle.contains(this,a,c)},containsRect:function(a){return b.Rectangle.containsRect(this,a)},equals:function(a){return b.Rectangle.equals(this,a)},intersection:function(a,c){return b.Rectangle.intersection(this,a,c)},intersects:function(a,c){return b.Rectangle.intersects(this,a,c)},intersectsRaw:function(a,c,d,e,f){return b.Rectangle.intersectsRaw(this,a,c,d,e,f)},union:function(a,c){return b.Rectangle.union(this,a,c)},toString:function(){return"[{Rectangle (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+" empty="+this.empty+")}]"},get halfWidth(){return Math.round(this.width/2)},get halfHeight(){return Math.round(this.height/2)},get bottom(){return this.y+this.height},set bottom(a){this.height=a<=this.y?0:this.y-a},get bottomRight(){return new b.Point(this.right,this.bottom)},set bottomRight(a){this.right=a.x,this.bottom=a.y},get left(){return this.x},set left(a){this.width=a>=this.right?0:this.right-a,this.x=a},get right(){return this.x+this.width},set right(a){this.width=a<=this.x?0:this.x+a},get volume(){return this.width*this.height},get perimeter(){return 2*this.width+2*this.height},get centerX(){return this.x+this.halfWidth},set centerX(a){this.x=a-this.halfWidth},get centerY(){return this.y+this.halfHeight},set centerY(a){this.y=a-this.halfHeight},get top(){return this.y},set top(a){a>=this.bottom?(this.height=0,this.y=a):this.height=this.bottom-a},get topLeft(){return new b.Point(this.x,this.y)},set topLeft(a){this.x=a.x,this.y=a.y},get empty(){return!this.width||!this.height},set empty(a){a===!0&&this.setTo(0,0,0,0)}},b.Rectangle.prototype.constructor=b.Rectangle,b.Rectangle.inflate=function(a,b,c){return a.x-=b,a.width+=2*b,a.y-=c,a.height+=2*c,a},b.Rectangle.inflatePoint=function(a,c){return b.Rectangle.inflate(a,c.x,c.y)},b.Rectangle.size=function(a,c){return"undefined"==typeof c?c=new b.Point(a.width,a.height):c.setTo(a.width,a.height),c},b.Rectangle.clone=function(a,c){return"undefined"==typeof c?c=new b.Rectangle(a.x,a.y,a.width,a.height):c.setTo(a.x,a.y,a.width,a.height),c},b.Rectangle.contains=function(a,b,c){return a.width<=0||a.height<=0?!1:b>=a.x&&b<=a.right&&c>=a.y&&c<=a.bottom},b.Rectangle.containsRaw=function(a,b,c,d,e,f){return e>=a&&a+c>=e&&f>=b&&b+d>=f},b.Rectangle.containsPoint=function(a,c){return b.Rectangle.contains(a,c.x,c.y)},b.Rectangle.containsRect=function(a,b){return a.volume>b.volume?!1:a.x>=b.x&&a.y>=b.y&&a.right<=b.right&&a.bottom<=b.bottom},b.Rectangle.equals=function(a,b){return a.x==b.x&&a.y==b.y&&a.width==b.width&&a.height==b.height},b.Rectangle.intersection=function(a,c,d){return"undefined"==typeof d&&(d=new b.Rectangle),b.Rectangle.intersects(a,c)&&(d.x=Math.max(a.x,c.x),d.y=Math.max(a.y,c.y),d.width=Math.min(a.right,c.right)-d.x,d.height=Math.min(a.bottom,c.bottom)-d.y),d},b.Rectangle.intersects=function(a,b){return a.width<=0||a.height<=0||b.width<=0||b.height<=0?!1:!(a.rightb.right||a.y>b.bottom)},b.Rectangle.intersectsRaw=function(a,b,c,d,e,f){return"undefined"==typeof f&&(f=0),!(b>a.right+f||ca.bottom+f||e=c&&d>=a&&b>=e&&f>=b}},Object.defineProperty(b.Line.prototype,"length",{get:function(){return Math.sqrt((this.end.x-this.start.x)*(this.end.x-this.start.x)+(this.end.y-this.start.y)*(this.end.y-this.start.y))}}),Object.defineProperty(b.Line.prototype,"angle",{get:function(){return Math.atan2(this.end.x-this.start.x,this.end.y-this.start.y)}}),Object.defineProperty(b.Line.prototype,"slope",{get:function(){return(this.end.y-this.start.y)/(this.end.x-this.start.x)}}),Object.defineProperty(b.Line.prototype,"perpSlope",{get:function(){return-((this.end.x-this.start.x)/(this.end.y-this.start.y))}}),b.Line.intersectsPoints=function(a,c,d,e,f,g){"undefined"==typeof f&&(f=!0),"undefined"==typeof g&&(g=new b.Point);var h=c.y-a.y,i=e.y-d.y,j=a.x-c.x,k=d.x-e.x,l=c.x*a.y-a.x*c.y,m=e.x*d.y-d.x*e.y,n=h*k-i*j;if(0===n)return null;if(g.x=(j*m-k*l)/n,g.y=(i*l-h*m)/n,f){if(Math.pow(g.x-c.x+(g.y-c.y),2)>Math.pow(a.x-c.x+(a.y-c.y),2))return null;if(Math.pow(g.x-a.x+(g.y-a.y),2)>Math.pow(a.x-c.x+(a.y-c.y),2))return null;if(Math.pow(g.x-e.x+(g.y-e.y),2)>Math.pow(d.x-e.x+(d.y-e.y),2))return null;if(Math.pow(g.x-d.x+(g.y-d.y),2)>Math.pow(d.x-e.x+(d.y-e.y),2))return null}return g},b.Line.intersects=function(a,c,d,e){return b.Line.intersectsPoints(a.start,a.end,c.start,c.end,d,e)},b.Ellipse=function(a,c,d,e){this.type=b.ELLIPSE,a=a||0,c=c||0,d=d||0,e=e||0,this.x=a,this.y=c,this.width=d,this.height=e},b.Ellipse.prototype={setTo:function(a,b,c,d){return this.x=a,this.y=b,this.width=c,this.height=d,this},copyFrom:function(a){return this.setTo(a.x,a.y,a.width,a.height)},copyTo:function(a){return a.x=this.x,a.y=this.y,a.width=this.width,a.height=this.height,a},clone:function(a){return"undefined"==typeof a?a=new b.Ellipse(this.x,this.y,this.width,this.height):a.setTo(this.x,this.y,this.width,this.height),a},contains:function(a,c){return b.Ellipse.contains(this,a,c)},toString:function(){return"[{Phaser.Ellipse (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+")}]"}},b.Ellipse.prototype.constructor=b.Ellipse,Object.defineProperty(b.Ellipse.prototype,"left",{get:function(){return this.x},set:function(a){this.x=a}}),Object.defineProperty(b.Ellipse.prototype,"right",{get:function(){return this.x+this.width},set:function(a){this.width=ad+e},b.Ellipse.prototype.getBounds=function(){return new b.Rectangle(this.x,this.y,this.width,this.height)},a.Ellipse=b.Ellipse,b.Polygon=function(a){if(this.type=b.POLYGON,a instanceof Array||(a=Array.prototype.slice.call(arguments)),"number"==typeof a[0]){for(var c=[],d=0,e=a.length;e>d;d+=2)c.push(new b.Point(a[d],a[d+1]));a=c}this.points=a},b.Polygon.prototype={clone:function(){for(var a=[],c=0;cb!=i>b&&(h-f)*(b-g)/(i-g)+f>a;j&&(c=!0)}return c}},b.Polygon.prototype.constructor=b.Polygon,a.Polygon=b.Polygon,a.determineMatrixArrayType=function(){return"undefined"!=typeof Float32Array?Float32Array:Array},a.Matrix2=a.determineMatrixArrayType(),a.Matrix=function(){this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0},a.Matrix.prototype.fromArray=function(a){this.a=a[0],this.b=a[1],this.c=a[3],this.d=a[4],this.tx=a[2],this.ty=a[5]},a.Matrix.prototype.toArray=function(a){this.array||(this.array=new Float32Array(9));var b=this.array;return a?(this.array[0]=this.a,this.array[1]=this.c,this.array[2]=0,this.array[3]=this.b,this.array[4]=this.d,this.array[5]=0,this.array[6]=this.tx,this.array[7]=this.ty,this.array[8]=1):(this.array[0]=this.a,this.array[1]=this.b,this.array[2]=this.tx,this.array[3]=this.c,this.array[4]=this.d,this.array[5]=this.ty,this.array[6]=0,this.array[7]=0,this.array[8]=1),b},a.identityMatrix=new a.Matrix,a.DisplayObject=function(){this.position=new a.Point,this.scale=new a.Point(1,1),this.pivot=new a.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.buttonMode=!1,this.renderable=!1,this.parent=null,this.stage=null,this.worldAlpha=1,this._interactive=!1,this.defaultCursor="pointer",this.worldTransform=new a.Matrix,this.color=[],this.dynamic=!0,this._sr=0,this._cr=1,this.filterArea=new a.Rectangle(0,0,1,1),this._bounds=new a.Rectangle(0,0,1,1),this._currentBounds=null,this._mask=null},a.DisplayObject.prototype.constructor=a.DisplayObject,a.DisplayObject.prototype.setInteractive=function(a){this.interactive=a},Object.defineProperty(a.DisplayObject.prototype,"interactive",{get:function(){return this._interactive},set:function(a){this._interactive=a,this.stage&&(this.stage.dirty=!0)}}),Object.defineProperty(a.DisplayObject.prototype,"worldVisible",{get:function(){var a=this;do{if(!a.visible)return!1;a=a.parent}while(a);return!0}}),Object.defineProperty(a.DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(a){this._mask&&(this._mask.isMask=!1),this._mask=a,this._mask&&(this._mask.isMask=!0)}}),Object.defineProperty(a.DisplayObject.prototype,"filters",{get:function(){return this._filters},set:function(a){if(a){for(var b=[],c=0;c=0&&b<=this.children.length))throw new Error(a+" The index "+b+" supplied is out of bounds "+this.children.length);a.parent&&a.parent.removeChild(a),a.parent=this,this.children.splice(b,0,a),this.stage&&a.setStageReference(this.stage)},a.DisplayObjectContainer.prototype.swapChildren=function(a,b){if(a!==b){var c=this.children.indexOf(a),d=this.children.indexOf(b);if(0>c||0>d)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[c]=b,this.children[d]=a}},a.DisplayObjectContainer.prototype.getChildAt=function(a){if(a>=0&&ab;b++)this.children[b].updateTransform()}},a.DisplayObjectContainer.prototype.getBounds=function(b){if(0===this.children.length)return a.EmptyRectangle;if(b){var c=this.worldTransform;this.worldTransform=b,this.updateTransform(),this.worldTransform=c}for(var d,e,f,g=1/0,h=1/0,i=-1/0,j=-1/0,k=!1,l=0,m=this.children.length;m>l;l++){var n=this.children[l];n.visible&&(k=!0,d=this.children[l].getBounds(b),g=ge?i:e,j=j>f?j:f)}if(!k)return a.EmptyRectangle;var o=this._bounds;return o.x=g,o.y=h,o.width=i-g,o.height=j-h,o},a.DisplayObjectContainer.prototype.getLocalBounds=function(){var b=this.worldTransform;this.worldTransform=a.identityMatrix;for(var c=0,d=this.children.length;d>c;c++)this.children[c].updateTransform();var e=this.getBounds();return this.worldTransform=b,e},a.DisplayObjectContainer.prototype.setStageReference=function(a){this.stage=a,this._interactive&&(this.stage.dirty=!0);for(var b=0,c=this.children.length;c>b;b++){var d=this.children[b];d.setStageReference(a)}},a.DisplayObjectContainer.prototype.removeStageReference=function(){for(var a=0,b=this.children.length;b>a;a++){var c=this.children[a];c.removeStageReference()}this._interactive&&(this.stage.dirty=!0),this.stage=null},a.DisplayObjectContainer.prototype._renderWebGL=function(a){if(this.visible&&!(this.alpha<=0)){var b,c;if(this._mask||this._filters){for(this._mask&&(a.spriteBatch.stop(),a.maskManager.pushMask(this.mask,a),a.spriteBatch.start()),this._filters&&(a.spriteBatch.flush(),a.filterManager.pushFilter(this._filterBlock)),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a);a.spriteBatch.stop(),this._filters&&a.filterManager.popFilter(),this._mask&&a.maskManager.popMask(a),a.spriteBatch.start()}else for(b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a)}},a.DisplayObjectContainer.prototype._renderCanvas=function(a){if(this.visible!==!1&&0!==this.alpha){this._mask&&a.maskManager.pushMask(this._mask,a.context);for(var b=0,c=this.children.length;c>b;b++){var d=this.children[b];d._renderCanvas(a)}this._mask&&a.maskManager.popMask(a.context)}},a.Sprite=function(b){a.DisplayObjectContainer.call(this),this.anchor=new a.Point,this.texture=b,this._width=0,this._height=0,this.tint=16777215,this.blendMode=a.blendModes.NORMAL,b.baseTexture.hasLoaded?this.onTextureUpdate():(this.onTextureUpdateBind=this.onTextureUpdate.bind(this),this.texture.addEventListener("update",this.onTextureUpdateBind)),this.renderable=!0},a.Sprite.prototype=Object.create(a.DisplayObjectContainer.prototype),a.Sprite.prototype.constructor=a.Sprite,Object.defineProperty(a.Sprite.prototype,"width",{get:function(){return this.scale.x*this.texture.frame.width},set:function(a){this.scale.x=a/this.texture.frame.width,this._width=a}}),Object.defineProperty(a.Sprite.prototype,"height",{get:function(){return this.scale.y*this.texture.frame.height},set:function(a){this.scale.y=a/this.texture.frame.height,this._height=a}}),a.Sprite.prototype.setTexture=function(a){this.texture.baseTexture!==a.baseTexture?(this.textureChange=!0,this.texture=a):this.texture=a,this.cachedTint=16777215,this.updateFrame=!0},a.Sprite.prototype.onTextureUpdate=function(){this._width&&(this.scale.x=this._width/this.texture.frame.width),this._height&&(this.scale.y=this._height/this.texture.frame.height),this.updateFrame=!0},a.Sprite.prototype.getBounds=function(a){var b=this.texture.frame.width,c=this.texture.frame.height,d=b*(1-this.anchor.x),e=b*-this.anchor.x,f=c*(1-this.anchor.y),g=c*-this.anchor.y,h=a||this.worldTransform,i=h.a,j=h.c,k=h.b,l=h.d,m=h.tx,n=h.ty,o=i*e+k*g+m,p=l*g+j*e+n,q=i*d+k*g+m,r=l*g+j*d+n,s=i*d+k*f+m,t=l*f+j*d+n,u=i*e+k*f+m,v=l*f+j*e+n,w=-1/0,x=-1/0,y=1/0,z=1/0;y=y>o?o:y,y=y>q?q:y,y=y>s?s:y,y=y>u?u:y,z=z>p?p:z,z=z>r?r:z,z=z>t?t:z,z=z>v?v:z,w=o>w?o:w,w=q>w?q:w,w=s>w?s:w,w=u>w?u:w,x=p>x?p:x,x=r>x?r:x,x=t>x?t:x,x=v>x?v:x;var A=this._bounds;return A.x=y,A.width=w-y,A.y=z,A.height=x-z,this._currentBounds=A,A},a.Sprite.prototype._renderWebGL=function(a){if(this.visible&&!(this.alpha<=0)){var b,c;if(this._mask||this._filters){var d=a.spriteBatch;for(this._mask&&(d.stop(),a.maskManager.pushMask(this.mask,a),d.start()),this._filters&&(d.flush(),a.filterManager.pushFilter(this._filterBlock)),d.render(this),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a);d.stop(),this._filters&&a.filterManager.popFilter(),this._mask&&a.maskManager.popMask(a),d.start()}else for(a.spriteBatch.render(this),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a)}},a.Sprite.prototype._renderCanvas=function(b){if(this.visible!==!1&&0!==this.alpha){var c=this.texture.frame,d=b.context,e=this.texture;if(this.blendMode!==b.currentBlendMode&&(b.currentBlendMode=this.blendMode,d.globalCompositeOperation=a.blendModesCanvas[b.currentBlendMode]),this._mask&&b.maskManager.pushMask(this._mask,b.context),c&&c.width&&c.height&&e.baseTexture.source){d.globalAlpha=this.worldAlpha;var f=this.worldTransform;if(b.roundPixels?d.setTransform(f.a,f.c,f.b,f.d,f.tx||0,f.ty||0):d.setTransform(f.a,f.c,f.b,f.d,f.tx,f.ty),b.smoothProperty&&b.scaleMode!==this.texture.baseTexture.scaleMode&&(b.scaleMode=this.texture.baseTexture.scaleMode,d[b.smoothProperty]=b.scaleMode===a.scaleModes.LINEAR),16777215!==this.tint){if(this.cachedTint!==this.tint){if(!e.baseTexture.hasLoaded)return;this.cachedTint=this.tint,this.tintedTexture=a.CanvasTinter.getTintedTexture(this,this.tint)}d.drawImage(this.tintedTexture,0,0,c.width,c.height,this.anchor.x*-c.width,this.anchor.y*-c.height,c.width,c.height)}else if(e.trim){var g=e.trim;d.drawImage(this.texture.baseTexture.source,c.x,c.y,c.width,c.height,g.x-this.anchor.x*g.width,g.y-this.anchor.y*g.height,c.width,c.height)}else d.drawImage(this.texture.baseTexture.source,c.x,c.y,c.width,c.height,this.anchor.x*-c.width,this.anchor.y*-c.height,c.width,c.height)}for(var h=0,i=this.children.length;i>h;h++){var j=this.children[h];j._renderCanvas(b)}this._mask&&b.maskManager.popMask(b.context)}},a.Sprite.fromFrame=function(b){var c=a.TextureCache[b];if(!c)throw new Error('The frameId "'+b+'" does not exist in the texture cache'+this);return new a.Sprite(c)},a.Sprite.fromImage=function(b,c,d){var e=a.Texture.fromImage(b,c,d);return new a.Sprite(e)},a.SpriteBatch=function(b){a.DisplayObjectContainer.call(this),this.textureThing=b,this.ready=!1},a.SpriteBatch.prototype=Object.create(a.DisplayObjectContainer.prototype),a.SpriteBatch.constructor=a.SpriteBatch,a.SpriteBatch.prototype.initWebGL=function(b){this.fastSpriteBatch=new a.WebGLFastSpriteBatch(b),this.ready=!0},a.SpriteBatch.prototype.updateTransform=function(){a.DisplayObject.prototype.updateTransform.call(this)},a.SpriteBatch.prototype._renderWebGL=function(a){!this.visible||this.alpha<=0||!this.children.length||(this.ready||this.initWebGL(a.gl),a.spriteBatch.stop(),a.shaderManager.activateShader(a.shaderManager.fastShader),this.fastSpriteBatch.begin(this,a),this.fastSpriteBatch.render(this),a.shaderManager.activateShader(a.shaderManager.defaultShader),a.spriteBatch.start())},a.SpriteBatch.prototype._renderCanvas=function(b){var c=b.context;c.globalAlpha=this.worldAlpha,a.DisplayObject.prototype.updateTransform.call(this);for(var d=this.worldTransform,e=!0,f=0;fe?(g>0&&(b+="\n"),b+=f[g]+" ",e=this.style.wordWrapWidth-h):(e-=i,b+=f[g]+" ")}d=2?parseInt(c[c.length-2],10):a.BitmapText.fonts[this.fontName].size,this.dirty=!0,this.tint=b.tint},a.BitmapText.prototype.updateText=function(){for(var b=a.BitmapText.fonts[this.fontName],c=new a.Point,d=null,e=[],f=0,g=[],h=0,i=this.fontSize/b.size,j=0;j=j;j++){var n=0;"right"===this.style.align?n=f-g[j]:"center"===this.style.align&&(n=(f-g[j])/2),m.push(n)}var o=this.children.length,p=e.length,q=this.tint||16777215;for(j=0;p>j;j++){var r=o>j?this.children[j]:this._pool.pop();r?r.setTexture(e[j].texture):r=new a.Sprite(e[j].texture),r.position.x=(e[j].position.x+m[e[j].line])*i,r.position.y=e[j].position.y*i,r.scale.x=r.scale.y=i,r.tint=q,r.parent||this.addChild(r)}for(;this.children.length>p;){var s=this.getChildAt(this.children.length-1);this._pool.push(s),this.removeChild(s)}this.textWidth=f*i,this.textHeight=(c.y+b.lineHeight)*i},a.BitmapText.prototype.updateTransform=function(){this.dirty&&(this.updateText(),this.dirty=!1),a.DisplayObjectContainer.prototype.updateTransform.call(this)},a.BitmapText.fonts={},a.Stage=function(b){a.DisplayObjectContainer.call(this),this.worldTransform=new a.Matrix,this.interactive=!0,this.interactionManager=new a.InteractionManager(this),this.dirty=!0,this.stage=this,this.stage.hitArea=new a.Rectangle(0,0,1e5,1e5),this.setBackgroundColor(b)},a.Stage.prototype=Object.create(a.DisplayObjectContainer.prototype),a.Stage.prototype.constructor=a.Stage,a.Stage.prototype.setInteractionDelegate=function(a){this.interactionManager.setTargetDomElement(a)},a.Stage.prototype.updateTransform=function(){this.worldAlpha=1;for(var a=0,b=this.children.length;b>a;a++)this.children[a].updateTransform();this.dirty&&(this.dirty=!1,this.interactionManager.dirty=!0),this.interactive&&this.interactionManager.update()},a.Stage.prototype.setBackgroundColor=function(b){this.backgroundColor=b||0,this.backgroundColorSplit=a.hex2rgb(this.backgroundColor);var c=this.backgroundColor.toString(16);c="000000".substr(0,6-c.length)+c,this.backgroundColorString="#"+c},a.Stage.prototype.getMousePosition=function(){return this.interactionManager.mouse.global},a.EventTarget=function(){var a={};this.addEventListener=this.on=function(b,c){void 0===a[b]&&(a[b]=[]),-1===a[b].indexOf(c)&&a[b].push(c)},this.dispatchEvent=this.emit=function(b){if(a[b.type]&&a[b.type].length)for(var c=0,d=a[b.type].length;d>c;c++)a[b.type][c](b)},this.removeEventListener=this.off=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)},this.removeAllEventListeners=function(b){var c=a[b];c&&(c.length=0)}},a.PolyK={},a.PolyK.Triangulate=function(b){var c=!0,d=b.length>>1;if(3>d)return[];for(var e=[],f=[],g=0;d>g;g++)f.push(g);g=0;for(var h=d;h>3;){var i=f[(g+0)%h],j=f[(g+1)%h],k=f[(g+2)%h],l=b[2*i],m=b[2*i+1],n=b[2*j],o=b[2*j+1],p=b[2*k],q=b[2*k+1],r=!1;if(a.PolyK._convex(l,m,n,o,p,q,c)){r=!0;for(var s=0;h>s;s++){var t=f[s];if(t!==i&&t!==j&&t!==k&&a.PolyK._PointInTriangle(b[2*t],b[2*t+1],l,m,n,o,p,q)){r=!1;break}}}if(r)e.push(i,j,k),f.splice((g+1)%h,1),h--,g=0;else if(g++>3*h){if(!c)return window.console.log("PIXI Warning: shape too complex to fill"),[];for(e=[],f=[],g=0;d>g;g++)f.push(g);g=0,h=d,c=!1}}return e.push(f[0],f[1],f[2]),e},a.PolyK._PointInTriangle=function(a,b,c,d,e,f,g,h){var i=g-c,j=h-d,k=e-c,l=f-d,m=a-c,n=b-d,o=i*i+j*j,p=i*k+j*l,q=i*m+j*n,r=k*k+l*l,s=k*m+l*n,t=1/(o*r-p*p),u=(r*q-p*s)*t,v=(o*s-p*q)*t; -return u>=0&&v>=0&&1>u+v},a.PolyK._convex=function(a,b,c,d,e,f,g){return(b-d)*(e-c)+(c-a)*(f-d)>=0===g},a.initDefaultShaders=function(){},a.CompileVertexShader=function(b,c){return a._CompileShader(b,c,b.VERTEX_SHADER)},a.CompileFragmentShader=function(b,c){return a._CompileShader(b,c,b.FRAGMENT_SHADER)},a._CompileShader=function(a,b,c){var d=b.join("\n"),e=a.createShader(c);return a.shaderSource(e,d),a.compileShader(e),a.getShaderParameter(e,a.COMPILE_STATUS)?e:(window.console.log(a.getShaderInfoLog(e)),null)},a.compileProgram=function(b,c,d){var e=a.CompileFragmentShader(b,d),f=a.CompileVertexShader(b,c),g=b.createProgram();return b.attachShader(g,f),b.attachShader(g,e),b.linkProgram(g),b.getProgramParameter(g,b.LINK_STATUS)||window.console.log("Could not initialise shaders"),g},a.PixiShader=function(a){this.gl=a,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.textureCount=0,this.attributes=[],this.init()},a.PixiShader.prototype.init=function(){var b=this.gl,c=a.compileProgram(b,this.vertexSrc||a.PixiShader.defaultVertexSrc,this.fragmentSrc);b.useProgram(c),this.uSampler=b.getUniformLocation(c,"uSampler"),this.projectionVector=b.getUniformLocation(c,"projectionVector"),this.offsetVector=b.getUniformLocation(c,"offsetVector"),this.dimensions=b.getUniformLocation(c,"dimensions"),this.aVertexPosition=b.getAttribLocation(c,"aVertexPosition"),this.aTextureCoord=b.getAttribLocation(c,"aTextureCoord"),this.colorAttribute=b.getAttribLocation(c,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aTextureCoord,this.colorAttribute];for(var d in this.uniforms)this.uniforms[d].uniformLocation=b.getUniformLocation(c,d);this.initUniforms(),this.program=c},a.PixiShader.prototype.initUniforms=function(){this.textureCount=1;var a,b=this.gl;for(var c in this.uniforms){a=this.uniforms[c];var d=a.type;"sampler2D"===d?(a._init=!1,null!==a.value&&this.initSampler2D(a)):"mat2"===d||"mat3"===d||"mat4"===d?(a.glMatrix=!0,a.glValueLength=1,"mat2"===d?a.glFunc=b.uniformMatrix2fv:"mat3"===d?a.glFunc=b.uniformMatrix3fv:"mat4"===d&&(a.glFunc=b.uniformMatrix4fv)):(a.glFunc=b["uniform"+d],a.glValueLength="2f"===d||"2i"===d?2:"3f"===d||"3i"===d?3:"4f"===d||"4i"===d?4:1)}},a.PixiShader.prototype.initSampler2D=function(a){if(a.value&&a.value.baseTexture&&a.value.baseTexture.hasLoaded){var b=this.gl;if(b.activeTexture(b["TEXTURE"+this.textureCount]),b.bindTexture(b.TEXTURE_2D,a.value.baseTexture._glTexture),a.textureData){var c=a.textureData,d=c.magFilter?c.magFilter:b.LINEAR,e=c.minFilter?c.minFilter:b.LINEAR,f=c.wrapS?c.wrapS:b.CLAMP_TO_EDGE,g=c.wrapT?c.wrapT:b.CLAMP_TO_EDGE,h=c.luminance?b.LUMINANCE:b.RGBA;if(c.repeat&&(f=b.REPEAT,g=b.REPEAT),b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,!!c.flipY),c.width){var i=c.width?c.width:512,j=c.height?c.height:2,k=c.border?c.border:0;b.texImage2D(b.TEXTURE_2D,0,h,i,j,k,h,b.UNSIGNED_BYTE,null)}else b.texImage2D(b.TEXTURE_2D,0,h,b.RGBA,b.UNSIGNED_BYTE,a.value.baseTexture.source);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,d),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,f),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,g)}b.uniform1i(a.uniformLocation,this.textureCount),a._init=!0,this.textureCount++}},a.PixiShader.prototype.syncUniforms=function(){this.textureCount=1;var b,c=this.gl;for(var d in this.uniforms)b=this.uniforms[d],1===b.glValueLength?b.glMatrix===!0?b.glFunc.call(c,b.uniformLocation,b.transpose,b.value):b.glFunc.call(c,b.uniformLocation,b.value):2===b.glValueLength?b.glFunc.call(c,b.uniformLocation,b.value.x,b.value.y):3===b.glValueLength?b.glFunc.call(c,b.uniformLocation,b.value.x,b.value.y,b.value.z):4===b.glValueLength?b.glFunc.call(c,b.uniformLocation,b.value.x,b.value.y,b.value.z,b.value.w):"sampler2D"===b.type&&(b._init?(c.activeTexture(c["TEXTURE"+this.textureCount]),c.bindTexture(c.TEXTURE_2D,b.value.baseTexture._glTextures[c.id]||a.createWebGLTexture(b.value.baseTexture,c)),c.uniform1i(b.uniformLocation,this.textureCount),this.textureCount++):this.initSampler2D(b))},a.PixiShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},a.PixiShader.defaultVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute vec2 aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying vec4 vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vec3 color = mod(vec3(aColor.y/65536.0, aColor.y/256.0, aColor.y), 256.0) / 256.0;"," vColor = vec4(color * aColor.x, aColor.x);","}"],a.PixiFastShader=function(a){this.gl=a,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"],this.textureCount=0,this.init()},a.PixiFastShader.prototype.init=function(){var b=this.gl,c=a.compileProgram(b,this.vertexSrc,this.fragmentSrc);b.useProgram(c),this.uSampler=b.getUniformLocation(c,"uSampler"),this.projectionVector=b.getUniformLocation(c,"projectionVector"),this.offsetVector=b.getUniformLocation(c,"offsetVector"),this.dimensions=b.getUniformLocation(c,"dimensions"),this.uMatrix=b.getUniformLocation(c,"uMatrix"),this.aVertexPosition=b.getAttribLocation(c,"aVertexPosition"),this.aPositionCoord=b.getAttribLocation(c,"aPositionCoord"),this.aScale=b.getAttribLocation(c,"aScale"),this.aRotation=b.getAttribLocation(c,"aRotation"),this.aTextureCoord=b.getAttribLocation(c,"aTextureCoord"),this.colorAttribute=b.getAttribLocation(c,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aPositionCoord,this.aScale,this.aRotation,this.aTextureCoord,this.colorAttribute],this.program=c},a.PixiFastShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},a.StripShader=function(){this.program=null,this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying float vColor;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));"," gl_FragColor = gl_FragColor * alpha;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","varying vec2 vTextureCoord;","uniform vec2 offsetVector;","varying float vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition, 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"]},a.StripShader.prototype.init=function(){var b=a.gl,c=a.compileProgram(b,this.vertexSrc,this.fragmentSrc);b.useProgram(c),this.uSampler=b.getUniformLocation(c,"uSampler"),this.projectionVector=b.getUniformLocation(c,"projectionVector"),this.offsetVector=b.getUniformLocation(c,"offsetVector"),this.colorAttribute=b.getAttribLocation(c,"aColor"),this.aVertexPosition=b.getAttribLocation(c,"aVertexPosition"),this.aTextureCoord=b.getAttribLocation(c,"aTextureCoord"),this.translationMatrix=b.getUniformLocation(c,"translationMatrix"),this.alpha=b.getUniformLocation(c,"alpha"),this.program=c},a.PrimitiveShader=function(a){this.gl=a,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec4 aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform float alpha;","uniform vec3 tint;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vColor = aColor * vec4(tint * alpha, alpha);","}"],this.init()},a.PrimitiveShader.prototype.init=function(){var b=this.gl,c=a.compileProgram(b,this.vertexSrc,this.fragmentSrc);b.useProgram(c),this.projectionVector=b.getUniformLocation(c,"projectionVector"),this.offsetVector=b.getUniformLocation(c,"offsetVector"),this.tintColor=b.getUniformLocation(c,"tint"),this.aVertexPosition=b.getAttribLocation(c,"aVertexPosition"),this.colorAttribute=b.getAttribLocation(c,"aColor"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=b.getUniformLocation(c,"translationMatrix"),this.alpha=b.getUniformLocation(c,"alpha"),this.program=c},a.PrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},a.WebGLGraphics=function(){},a.WebGLGraphics.renderGraphics=function(b,c){var d=c.gl,e=c.projection,f=c.offset,g=c.shaderManager.primitiveShader;b._webGL[d.id]||(b._webGL[d.id]={points:[],indices:[],lastIndex:0,buffer:d.createBuffer(),indexBuffer:d.createBuffer()});var h=b._webGL[d.id];b.dirty&&(b.dirty=!1,b.clearDirty&&(b.clearDirty=!1,h.lastIndex=0,h.points=[],h.indices=[]),a.WebGLGraphics.updateGraphics(b,d)),c.shaderManager.activatePrimitiveShader(),d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA),d.uniformMatrix3fv(g.translationMatrix,!1,b.worldTransform.toArray(!0)),d.uniform2f(g.projectionVector,e.x,-e.y),d.uniform2f(g.offsetVector,-f.x,-f.y),d.uniform3fv(g.tintColor,a.hex2rgb(b.tint)),d.uniform1f(g.alpha,b.worldAlpha),d.bindBuffer(d.ARRAY_BUFFER,h.buffer),d.vertexAttribPointer(g.aVertexPosition,2,d.FLOAT,!1,24,0),d.vertexAttribPointer(g.colorAttribute,4,d.FLOAT,!1,24,8),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.indexBuffer),d.drawElements(d.TRIANGLE_STRIP,h.indices.length,d.UNSIGNED_SHORT,0),c.shaderManager.deactivatePrimitiveShader()},a.WebGLGraphics.updateGraphics=function(b,c){for(var d=b._webGL[c.id],e=d.lastIndex;e3&&a.WebGLGraphics.buildPoly(f,d),f.lineWidth>0&&a.WebGLGraphics.buildLine(f,d)):f.type===a.Graphics.RECT?a.WebGLGraphics.buildRectangle(f,d):(f.type===a.Graphics.CIRC||f.type===a.Graphics.ELIP)&&a.WebGLGraphics.buildCircle(f,d)}d.lastIndex=b.graphicsData.length,d.glPoints=new Float32Array(d.points),c.bindBuffer(c.ARRAY_BUFFER,d.buffer),c.bufferData(c.ARRAY_BUFFER,d.glPoints,c.STATIC_DRAW),d.glIndicies=new Uint16Array(d.indices),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,d.indexBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,d.glIndicies,c.STATIC_DRAW)},a.WebGLGraphics.buildRectangle=function(b,c){var d=b.points,e=d[0],f=d[1],g=d[2],h=d[3];if(b.fill){var i=a.hex2rgb(b.fillColor),j=b.fillAlpha,k=i[0]*j,l=i[1]*j,m=i[2]*j,n=c.points,o=c.indices,p=n.length/6;n.push(e,f),n.push(k,l,m,j),n.push(e+g,f),n.push(k,l,m,j),n.push(e,f+h),n.push(k,l,m,j),n.push(e+g,f+h),n.push(k,l,m,j),o.push(p,p,p+1,p+2,p+3,p+3)}if(b.lineWidth){var q=b.points;b.points=[e,f,e+g,f,e+g,f+h,e,f+h,e,f],a.WebGLGraphics.buildLine(b,c),b.points=q}},a.WebGLGraphics.buildCircle=function(b,c){var d=b.points,e=d[0],f=d[1],g=d[2],h=d[3],i=40,j=2*Math.PI/i,k=0;if(b.fill){var l=a.hex2rgb(b.fillColor),m=b.fillAlpha,n=l[0]*m,o=l[1]*m,p=l[2]*m,q=c.points,r=c.indices,s=q.length/6;for(r.push(s),k=0;i+1>k;k++)q.push(e,f,n,o,p,m),q.push(e+Math.sin(j*k)*g,f+Math.cos(j*k)*h,n,o,p,m),r.push(s++,s++);r.push(s-1)}if(b.lineWidth){var t=b.points;for(b.points=[],k=0;i+1>k;k++)b.points.push(e+Math.sin(j*k)*g,f+Math.cos(j*k)*h);a.WebGLGraphics.buildLine(b,c),b.points=t}},a.WebGLGraphics.buildLine=function(b,c){var d=0,e=b.points;if(0!==e.length){if(b.lineWidth%2)for(d=0;dd;d++)l=e[2*(d-1)],m=e[2*(d-1)+1],n=e[2*d],o=e[2*d+1],p=e[2*(d+1)],q=e[2*(d+1)+1],r=-(m-o),s=l-n,F=Math.sqrt(r*r+s*s),r/=F,s/=F,r*=L,s*=L,t=-(o-q),u=n-p,F=Math.sqrt(t*t+u*u),t/=F,u/=F,t*=L,u*=L,x=-s+m-(-s+o),y=-r+n-(-r+l),z=(-r+l)*(-s+o)-(-r+n)*(-s+m),A=-u+q-(-u+o),B=-t+n-(-t+p),C=(-t+p)*(-u+o)-(-t+n)*(-u+q),D=x*B-A*y,Math.abs(D)<.1?(D+=10.1,G.push(n-r,o-s,O,P,Q,N),G.push(n+r,o+s,O,P,Q,N)):(j=(y*C-B*z)/D,k=(A*z-x*C)/D,E=(j-n)*(j-n)+(k-o)+(k-o),E>19600?(v=r-t,w=s-u,F=Math.sqrt(v*v+w*w),v/=F,w/=F,v*=L,w*=L,G.push(n-v,o-w),G.push(O,P,Q,N),G.push(n+v,o+w),G.push(O,P,Q,N),G.push(n-v,o-w),G.push(O,P,Q,N),J++):(G.push(j,k),G.push(O,P,Q,N),G.push(n-(j-n),o-(k-o)),G.push(O,P,Q,N)));for(l=e[2*(I-2)],m=e[2*(I-2)+1],n=e[2*(I-1)],o=e[2*(I-1)+1],r=-(m-o),s=l-n,F=Math.sqrt(r*r+s*s),r/=F,s/=F,r*=L,s*=L,G.push(n-r,o-s),G.push(O,P,Q,N),G.push(n+r,o+s),G.push(O,P,Q,N),H.push(K),d=0;J>d;d++)H.push(K++);H.push(K-1)}},a.WebGLGraphics.buildPoly=function(b,c){var d=b.points;if(!(d.length<6)){var e=c.points,f=c.indices,g=d.length/2,h=a.hex2rgb(b.fillColor),i=b.fillAlpha,j=h[0]*i,k=h[1]*i,l=h[2]*i,m=a.PolyK.Triangulate(d),n=e.length/6,o=0;for(o=0;oo;o++)e.push(d[2*o],d[2*o+1],j,k,l,i)}},a.glContexts=[],a.WebGLRenderer=function(b,c,d,e,f){a.defaultRenderer||(a.defaultRenderer=this),this.type=a.WEBGL_RENDERER,this.transparent=!!e,this.width=b||800,this.height=c||600,this.view=d||document.createElement("canvas"),this.view.width=this.width,this.view.height=this.height,this.contextLost=this.handleContextLost.bind(this),this.contextRestoredLost=this.handleContextRestored.bind(this),this.view.addEventListener("webglcontextlost",this.contextLost,!1),this.view.addEventListener("webglcontextrestored",this.contextRestoredLost,!1),this.options={alpha:this.transparent,antialias:!!f,premultipliedAlpha:!!e,stencil:!0};try{this.gl=this.view.getContext("experimental-webgl",this.options)}catch(g){try{this.gl=this.view.getContext("webgl",this.options)}catch(h){throw new Error(" This browser does not support webGL. Try using the canvas renderer"+this)}}var i=this.gl;this.glContextId=i.id=a.WebGLRenderer.glContextId++,a.glContexts[this.glContextId]=i,a.blendModesWebGL||(a.blendModesWebGL=[],a.blendModesWebGL[a.blendModes.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.ADD]=[i.SRC_ALPHA,i.DST_ALPHA],a.blendModesWebGL[a.blendModes.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.SCREEN]=[i.SRC_ALPHA,i.ONE],a.blendModesWebGL[a.blendModes.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA]),this.projection=new a.Point,this.projection.x=this.width/2,this.projection.y=-this.height/2,this.offset=new a.Point(0,0),this.resize(this.width,this.height),this.contextLost=!1,this.shaderManager=new a.WebGLShaderManager(i),this.spriteBatch=new a.WebGLSpriteBatch(i),this.maskManager=new a.WebGLMaskManager(i),this.filterManager=new a.WebGLFilterManager(i,this.transparent),this.renderSession={},this.renderSession.gl=this.gl,this.renderSession.drawCount=0,this.renderSession.shaderManager=this.shaderManager,this.renderSession.maskManager=this.maskManager,this.renderSession.filterManager=this.filterManager,this.renderSession.spriteBatch=this.spriteBatch,i.useProgram(this.shaderManager.defaultShader.program),i.disable(i.DEPTH_TEST),i.disable(i.CULL_FACE),i.enable(i.BLEND),i.colorMask(!0,!0,!0,this.transparent)},a.WebGLRenderer.prototype.constructor=a.WebGLRenderer,a.WebGLRenderer.prototype.render=function(b){if(!this.contextLost){this.__stage!==b&&(b.interactive&&b.interactionManager.removeEvents(),this.__stage=b),a.WebGLRenderer.updateTextures(),b.updateTransform();var c=this.gl;c.viewport(0,0,this.width,this.height),c.bindFramebuffer(c.FRAMEBUFFER,null),this.transparent?c.clearColor(0,0,0,0):c.clearColor(b.backgroundColorSplit[0],b.backgroundColorSplit[1],b.backgroundColorSplit[2],1),c.clear(c.COLOR_BUFFER_BIT),this.renderDisplayObject(b,this.projection),b.interactive?b._interactiveEventsAdded||(b._interactiveEventsAdded=!0,b.interactionManager.setTarget(this)):b._interactiveEventsAdded&&(b._interactiveEventsAdded=!1,b.interactionManager.setTarget(this))}},a.WebGLRenderer.prototype.renderDisplayObject=function(a,b,c){this.renderSession.drawCount=0,this.renderSession.currentBlendMode=9999,this.renderSession.projection=b,this.renderSession.offset=this.offset,this.spriteBatch.begin(this.renderSession),this.filterManager.begin(this.renderSession,c),a._renderWebGL(this.renderSession),this.spriteBatch.end()},a.WebGLRenderer.updateTextures=function(){var b=0;for(b=0;b=0;c--){var d=b._glTextures[c],e=a.glContexts[c];e&&d&&e.deleteTexture(d)}b._glTextures.length=0},a.WebGLRenderer.updateTextureFrame=function(a){a.updateFrame=!1,a._updateWebGLuvs()},a.WebGLRenderer.prototype.resize=function(a,b){this.width=a,this.height=b,this.view.width=a,this.view.height=b,this.gl.viewport(0,0,this.width,this.height),this.projection.x=this.width/2,this.projection.y=-this.height/2},a.createWebGLTexture=function(b,c){return b.hasLoaded&&(b._glTextures[c.id]=c.createTexture(),c.bindTexture(c.TEXTURE_2D,b._glTextures[c.id]),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.source),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,b.scaleMode===a.scaleModes.LINEAR?c.LINEAR:c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,b.scaleMode===a.scaleModes.LINEAR?c.LINEAR:c.NEAREST),b._powerOf2?(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.REPEAT),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.REPEAT)):(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE)),c.bindTexture(c.TEXTURE_2D,null)),b._glTextures[c.id]},a.updateWebGLTexture=function(b,c){b._glTextures[c.id]&&(c.bindTexture(c.TEXTURE_2D,b._glTextures[c.id]),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.source),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,b.scaleMode===a.scaleModes.LINEAR?c.LINEAR:c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,b.scaleMode===a.scaleModes.LINEAR?c.LINEAR:c.NEAREST),b._powerOf2?(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.REPEAT),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.REPEAT)):(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE)),c.bindTexture(c.TEXTURE_2D,null))},a.WebGLRenderer.prototype.handleContextLost=function(a){a.preventDefault(),this.contextLost=!0},a.WebGLRenderer.prototype.handleContextRestored=function(){try{this.gl=this.view.getContext("experimental-webgl",this.options)}catch(b){try{this.gl=this.view.getContext("webgl",this.options)}catch(c){throw new Error(" This browser does not support webGL. Try using the canvas renderer"+this)}}var d=this.gl;d.id=a.WebGLRenderer.glContextId++,this.shaderManager.setContext(d),this.spriteBatch.setContext(d),this.maskManager.setContext(d),this.filterManager.setContext(d),this.renderSession.gl=this.gl,d.disable(d.DEPTH_TEST),d.disable(d.CULL_FACE),d.enable(d.BLEND),d.colorMask(!0,!0,!0,this.transparent),this.gl.viewport(0,0,this.width,this.height);for(var e in a.TextureCache){var f=a.TextureCache[e].baseTexture;f._glTextures=[]}this.contextLost=!1},a.WebGLRenderer.prototype.destroy=function(){this.view.removeEventListener("webglcontextlost",this.contextLost),this.view.removeEventListener("webglcontextrestored",this.contextRestoredLost),a.glContexts[this.glContextId]=null,this.projection=null,this.offset=null,this.shaderManager.destroy(),this.spriteBatch.destroy(),this.maskManager.destroy(),this.filterManager.destroy(),this.shaderManager=null,this.spriteBatch=null,this.maskManager=null,this.filterManager=null,this.gl=null,this.renderSession=null},a.WebGLRenderer.glContextId=0,a.WebGLMaskManager=function(a){this.maskStack=[],this.maskPosition=0,this.setContext(a)},a.WebGLMaskManager.prototype.setContext=function(a){this.gl=a},a.WebGLMaskManager.prototype.pushMask=function(b,c){var d=this.gl;0===this.maskStack.length&&(d.enable(d.STENCIL_TEST),d.stencilFunc(d.ALWAYS,1,1)),this.maskStack.push(b),d.colorMask(!1,!1,!1,!0),d.stencilOp(d.KEEP,d.KEEP,d.INCR),a.WebGLGraphics.renderGraphics(b,c),d.colorMask(!0,!0,!0,!0),d.stencilFunc(d.NOTEQUAL,0,this.maskStack.length),d.stencilOp(d.KEEP,d.KEEP,d.KEEP)},a.WebGLMaskManager.prototype.popMask=function(b){var c=this.gl,d=this.maskStack.pop();d&&(c.colorMask(!1,!1,!1,!1),c.stencilOp(c.KEEP,c.KEEP,c.DECR),a.WebGLGraphics.renderGraphics(d,b),c.colorMask(!0,!0,!0,!0),c.stencilFunc(c.NOTEQUAL,0,this.maskStack.length),c.stencilOp(c.KEEP,c.KEEP,c.KEEP)),0===this.maskStack.length&&c.disable(c.STENCIL_TEST)},a.WebGLMaskManager.prototype.destroy=function(){this.maskStack=null,this.gl=null},a.WebGLShaderManager=function(a){this.maxAttibs=10,this.attribState=[],this.tempAttribState=[];for(var b=0;bd;d+=6,e+=4)this.indices[d+0]=e+0,this.indices[d+1]=e+1,this.indices[d+2]=e+2,this.indices[d+3]=e+0,this.indices[d+4]=e+2,this.indices[d+5]=e+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.setContext(a)},a.WebGLSpriteBatch.prototype.setContext=function(a){this.gl=a,this.vertexBuffer=a.createBuffer(),this.indexBuffer=a.createBuffer(),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,this.indices,a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bufferData(a.ARRAY_BUFFER,this.vertices,a.DYNAMIC_DRAW),this.currentBlendMode=99999},a.WebGLSpriteBatch.prototype.begin=function(a){this.renderSession=a,this.shader=this.renderSession.shaderManager.defaultShader,this.start()},a.WebGLSpriteBatch.prototype.end=function(){this.flush()},a.WebGLSpriteBatch.prototype.render=function(a){(a.texture.baseTexture!==this.currentBaseTexture||this.currentBatchSize>=this.size)&&(this.flush(),this.currentBaseTexture=a.texture.baseTexture),a.blendMode!==this.currentBlendMode&&this.setBlendMode(a.blendMode);var b=a._uvs||a.texture._uvs;if(b){var c,d,e,f,g=a.worldAlpha,h=a.tint,i=this.vertices,j=a.texture.frame.width,k=a.texture.frame.height,l=a.anchor.x,m=a.anchor.y;if(a.texture.trim){var n=a.texture.trim;d=n.x-l*n.width,c=d+j,f=n.y-m*n.height,e=f+k}else c=j*(1-l),d=j*-l,e=k*(1-m),f=k*-m;var o=4*this.currentBatchSize*this.vertSize,p=a.worldTransform,q=p.a,r=p.c,s=p.b,t=p.d,u=p.tx,v=p.ty;i[o++]=q*d+s*f+u,i[o++]=t*f+r*d+v,i[o++]=b.x0,i[o++]=b.y0,i[o++]=g,i[o++]=h,i[o++]=q*c+s*f+u,i[o++]=t*f+r*c+v,i[o++]=b.x1,i[o++]=b.y1,i[o++]=g,i[o++]=h,i[o++]=q*c+s*e+u,i[o++]=t*e+r*c+v,i[o++]=b.x2,i[o++]=b.y2,i[o++]=g,i[o++]=h,i[o++]=q*d+s*e+u,i[o++]=t*e+r*d+v,i[o++]=b.x3,i[o++]=b.y3,i[o++]=g,i[o++]=h,this.currentBatchSize++}},a.WebGLSpriteBatch.prototype.renderTilingSprite=function(b){var c=b.tilingTexture;(c.baseTexture!==this.currentBaseTexture||this.currentBatchSize>=this.size)&&(this.flush(),this.currentBaseTexture=c.baseTexture),b.blendMode!==this.currentBlendMode&&this.setBlendMode(b.blendMode),b._uvs||(b._uvs=new a.TextureUvs);var d=b._uvs;b.tilePosition.x%=c.baseTexture.width*b.tileScaleOffset.x,b.tilePosition.y%=c.baseTexture.height*b.tileScaleOffset.y;var e=b.tilePosition.x/(c.baseTexture.width*b.tileScaleOffset.x),f=b.tilePosition.y/(c.baseTexture.height*b.tileScaleOffset.y),g=b.width/c.baseTexture.width/(b.tileScale.x*b.tileScaleOffset.x),h=b.height/c.baseTexture.height/(b.tileScale.y*b.tileScaleOffset.y);d.x0=0-e,d.y0=0-f,d.x1=1*g-e,d.y1=0-f,d.x2=1*g-e,d.y2=1*h-f,d.x3=0-e,d.y3=1*h-f;var i=b.worldAlpha,j=b.tint,k=this.vertices,l=b.width,m=b.height,n=b.anchor.x,o=b.anchor.y,p=l*(1-n),q=l*-n,r=m*(1-o),s=m*-o,t=4*this.currentBatchSize*this.vertSize,u=b.worldTransform,v=u.a,w=u.c,x=u.b,y=u.d,z=u.tx,A=u.ty;k[t++]=v*q+x*s+z,k[t++]=y*s+w*q+A,k[t++]=d.x0,k[t++]=d.y0,k[t++]=i,k[t++]=j,k[t++]=v*p+x*s+z,k[t++]=y*s+w*p+A,k[t++]=d.x1,k[t++]=d.y1,k[t++]=i,k[t++]=j,k[t++]=v*p+x*r+z,k[t++]=y*r+w*p+A,k[t++]=d.x2,k[t++]=d.y2,k[t++]=i,k[t++]=j,k[t++]=v*q+x*r+z,k[t++]=y*r+w*q+A,k[t++]=d.x3,k[t++]=d.y3,k[t++]=i,k[t++]=j,this.currentBatchSize++},a.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var b=this.gl;if(b.bindTexture(b.TEXTURE_2D,this.currentBaseTexture._glTextures[b.id]||a.createWebGLTexture(this.currentBaseTexture,b)),this.currentBatchSize>.5*this.size)b.bufferSubData(b.ARRAY_BUFFER,0,this.vertices);else{var c=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);b.bufferSubData(b.ARRAY_BUFFER,0,c)}b.drawElements(b.TRIANGLES,6*this.currentBatchSize,b.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},a.WebGLSpriteBatch.prototype.stop=function(){this.flush()},a.WebGLSpriteBatch.prototype.start=function(){var b=this.gl;b.activeTexture(b.TEXTURE0),b.bindBuffer(b.ARRAY_BUFFER,this.vertexBuffer),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var c=this.renderSession.projection;b.uniform2f(this.shader.projectionVector,c.x,c.y);var d=4*this.vertSize;b.vertexAttribPointer(this.shader.aVertexPosition,2,b.FLOAT,!1,d,0),b.vertexAttribPointer(this.shader.aTextureCoord,2,b.FLOAT,!1,d,8),b.vertexAttribPointer(this.shader.colorAttribute,2,b.FLOAT,!1,d,16),this.currentBlendMode!==a.blendModes.NORMAL&&this.setBlendMode(a.blendModes.NORMAL)},a.WebGLSpriteBatch.prototype.setBlendMode=function(b){this.flush(),this.currentBlendMode=b;var c=a.blendModesWebGL[this.currentBlendMode];this.gl.blendFunc(c[0],c[1])},a.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null},a.WebGLFastSpriteBatch=function(a){this.vertSize=10,this.maxSize=6e3,this.size=this.maxSize;var b=4*this.size*this.vertSize,c=6*this.maxSize;this.vertices=new Float32Array(b),this.indices=new Uint16Array(c),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var d=0,e=0;c>d;d+=6,e+=4)this.indices[d+0]=e+0,this.indices[d+1]=e+1,this.indices[d+2]=e+2,this.indices[d+3]=e+0,this.indices[d+4]=e+2,this.indices[d+5]=e+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.currentBlendMode=0,this.renderSession=null,this.shader=null,this.matrix=null,this.setContext(a)},a.WebGLFastSpriteBatch.prototype.setContext=function(a){this.gl=a,this.vertexBuffer=a.createBuffer(),this.indexBuffer=a.createBuffer(),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,this.indices,a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bufferData(a.ARRAY_BUFFER,this.vertices,a.DYNAMIC_DRAW),this.currentBlendMode=99999},a.WebGLFastSpriteBatch.prototype.begin=function(a,b){this.renderSession=b,this.shader=this.renderSession.shaderManager.fastShader,this.matrix=a.worldTransform.toArray(!0),this.start()},a.WebGLFastSpriteBatch.prototype.end=function(){this.flush()},a.WebGLFastSpriteBatch.prototype.render=function(a){var b=a.children,c=b[0];if(c.texture._uvs){this.currentBaseTexture=c.texture.baseTexture,c.blendMode!==this.currentBlendMode&&this.setBlendMode(c.blendMode);for(var d=0,e=b.length;e>d;d++)this.renderSprite(b[d]);this.flush()}},a.WebGLFastSpriteBatch.prototype.renderSprite=function(a){if(a.texture.baseTexture===this.currentBaseTexture||(this.flush(),this.currentBaseTexture=a.texture.baseTexture,a.texture._uvs)){var b,c,d,e,f,g,h,i,j=this.vertices;if(b=a.texture._uvs,c=a.texture.frame.width,d=a.texture.frame.height,a.texture.trim){var k=a.texture.trim;f=k.x-a.anchor.x*k.width,e=f+a.texture.frame.width,h=k.y-a.anchor.y*k.height,g=h+a.texture.frame.height}else e=a.texture.frame.width*(1-a.anchor.x),f=a.texture.frame.width*-a.anchor.x,g=a.texture.frame.height*(1-a.anchor.y),h=a.texture.frame.height*-a.anchor.y; -i=4*this.currentBatchSize*this.vertSize,j[i++]=f,j[i++]=h,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x0,j[i++]=b.y1,j[i++]=a.alpha,j[i++]=e,j[i++]=h,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x1,j[i++]=b.y1,j[i++]=a.alpha,j[i++]=e,j[i++]=g,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x2,j[i++]=b.y2,j[i++]=a.alpha,j[i++]=f,j[i++]=g,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x3,j[i++]=b.y3,j[i++]=a.alpha,this.currentBatchSize++,this.currentBatchSize>=this.size&&this.flush()}},a.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var b=this.gl;if(this.currentBaseTexture._glTextures[b.id]||a.createWebGLTexture(this.currentBaseTexture,b),b.bindTexture(b.TEXTURE_2D,this.currentBaseTexture._glTextures[b.id]),this.currentBatchSize>.5*this.size)b.bufferSubData(b.ARRAY_BUFFER,0,this.vertices);else{var c=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);b.bufferSubData(b.ARRAY_BUFFER,0,c)}b.drawElements(b.TRIANGLES,6*this.currentBatchSize,b.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},a.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},a.WebGLFastSpriteBatch.prototype.start=function(){var b=this.gl;b.activeTexture(b.TEXTURE0),b.bindBuffer(b.ARRAY_BUFFER,this.vertexBuffer),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var c=this.renderSession.projection;b.uniform2f(this.shader.projectionVector,c.x,c.y),b.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var d=4*this.vertSize;b.vertexAttribPointer(this.shader.aVertexPosition,2,b.FLOAT,!1,d,0),b.vertexAttribPointer(this.shader.aPositionCoord,2,b.FLOAT,!1,d,8),b.vertexAttribPointer(this.shader.aScale,2,b.FLOAT,!1,d,16),b.vertexAttribPointer(this.shader.aRotation,1,b.FLOAT,!1,d,24),b.vertexAttribPointer(this.shader.aTextureCoord,2,b.FLOAT,!1,d,28),b.vertexAttribPointer(this.shader.colorAttribute,1,b.FLOAT,!1,d,36),this.currentBlendMode!==a.blendModes.NORMAL&&this.setBlendMode(a.blendModes.NORMAL)},a.WebGLFastSpriteBatch.prototype.setBlendMode=function(b){this.flush(),this.currentBlendMode=b;var c=a.blendModesWebGL[this.currentBlendMode];this.gl.blendFunc(c[0],c[1])},a.WebGLFilterManager=function(a,b){this.transparent=b,this.filterStack=[],this.offsetX=0,this.offsetY=0,this.setContext(a)},a.WebGLFilterManager.prototype.setContext=function(a){this.gl=a,this.texturePool=[],this.initShaderBuffers()},a.WebGLFilterManager.prototype.begin=function(a,b){this.renderSession=a,this.defaultShader=a.shaderManager.defaultShader;var c=this.renderSession.projection;this.width=2*c.x,this.height=2*-c.y,this.buffer=b},a.WebGLFilterManager.prototype.pushFilter=function(b){var c=this.gl,d=this.renderSession.projection,e=this.renderSession.offset;this.filterStack.push(b);var f=b.filterPasses[0];this.offsetX+=b.target.filterArea.x,this.offsetY+=b.target.filterArea.y;var g=this.texturePool.pop();g?g.resize(this.width,this.height):g=new a.FilterTexture(this.gl,this.width,this.height),c.bindTexture(c.TEXTURE_2D,g.texture),b.target.filterArea=b.target.getBounds();var h=b.target.filterArea,i=f.padding;h.x-=i,h.y-=i,h.width+=2*i,h.height+=2*i,h.x<0&&(h.x=0),h.width>this.width&&(h.width=this.width),h.y<0&&(h.y=0),h.height>this.height&&(h.height=this.height),c.bindFramebuffer(c.FRAMEBUFFER,g.frameBuffer),c.viewport(0,0,h.width,h.height),d.x=h.width/2,d.y=-h.height/2,e.x=-h.x,e.y=-h.y,c.uniform2f(this.defaultShader.projectionVector,h.width/2,-h.height/2),c.uniform2f(this.defaultShader.offsetVector,-h.x,-h.y),c.colorMask(!0,!0,!0,!0),c.clearColor(0,0,0,0),c.clear(c.COLOR_BUFFER_BIT),b._glFilterTexture=g},a.WebGLFilterManager.prototype.popFilter=function(){var b=this.gl,c=this.filterStack.pop(),d=c.target.filterArea,e=c._glFilterTexture,f=this.renderSession.projection,g=this.renderSession.offset;if(c.filterPasses.length>1){b.viewport(0,0,d.width,d.height),b.bindBuffer(b.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=d.height,this.vertexArray[2]=d.width,this.vertexArray[3]=d.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=d.width,this.vertexArray[7]=0,b.bufferSubData(b.ARRAY_BUFFER,0,this.vertexArray),b.bindBuffer(b.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=d.width/this.width,this.uvArray[5]=d.height/this.height,this.uvArray[6]=d.width/this.width,this.uvArray[7]=d.height/this.height,b.bufferSubData(b.ARRAY_BUFFER,0,this.uvArray);var h=e,i=this.texturePool.pop();i||(i=new a.FilterTexture(this.gl,this.width,this.height)),b.bindFramebuffer(b.FRAMEBUFFER,i.frameBuffer),b.clear(b.COLOR_BUFFER_BIT),b.disable(b.BLEND);for(var j=0;j0&&(a.Texture.frameUpdates.length=0)},a.CanvasRenderer.prototype.resize=function(a,b){this.width=a,this.height=b,this.view.width=a,this.view.height=b},a.CanvasRenderer.prototype.renderDisplayObject=function(a,b){this.renderSession.context=b||this.context,a._renderCanvas(this.renderSession)},a.CanvasRenderer.prototype.renderStripFlat=function(a){var b=this.context,c=a.verticies,d=c.length/2;this.count++,b.beginPath();for(var e=1;d-2>e;e++){var f=2*e,g=c[f],h=c[f+2],i=c[f+4],j=c[f+1],k=c[f+3],l=c[f+5];b.moveTo(g,j),b.lineTo(h,k),b.lineTo(i,l)}b.fillStyle="#FF0000",b.fill(),b.closePath()},a.CanvasRenderer.prototype.renderStrip=function(a){var b=this.context,c=a.verticies,d=a.uvs,e=c.length/2;this.count++;for(var f=1;e-2>f;f++){var g=2*f,h=c[g],i=c[g+2],j=c[g+4],k=c[g+1],l=c[g+3],m=c[g+5],n=d[g]*a.texture.width,o=d[g+2]*a.texture.width,p=d[g+4]*a.texture.width,q=d[g+1]*a.texture.height,r=d[g+3]*a.texture.height,s=d[g+5]*a.texture.height;b.save(),b.beginPath(),b.moveTo(h,k),b.lineTo(i,l),b.lineTo(j,m),b.closePath(),b.clip();var t=n*r+q*p+o*s-r*p-q*o-n*s,u=h*r+q*j+i*s-r*j-q*i-h*s,v=n*i+h*p+o*j-i*p-h*o-n*j,w=n*r*j+q*i*p+h*o*s-h*r*p-q*o*j-n*i*s,x=k*r+q*m+l*s-r*m-q*l-k*s,y=n*l+k*p+o*m-l*p-k*o-n*m,z=n*r*m+q*l*p+k*o*s-k*r*p-q*o*m-n*l*s;b.transform(u/t,x/t,v/t,y/t,w/t,z/t),b.drawImage(a.texture.baseTexture.source,0,0),b.restore()}},a.CanvasBuffer=function(a,b){this.width=a,this.height=b,this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.canvas.width=a,this.canvas.height=b},a.CanvasBuffer.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)},a.CanvasBuffer.prototype.resize=function(a,b){this.width=this.canvas.width=a,this.height=this.canvas.height=b},a.CanvasGraphics=function(){},a.CanvasGraphics.renderGraphics=function(b,c){for(var d=b.worldAlpha,e="",f=0;f1&&(d=1,window.console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object"));for(var e=0;1>e;e++){var f=b.graphicsData[e],g=f.points;if(f.type===a.Graphics.POLY){c.beginPath(),c.moveTo(g[0],g[1]);for(var h=1;hd;d++)this.children[d]._renderWebGL(b);b.spriteBatch.stop()}this._filters&&b.filterManager.popFilter(),this._mask&&b.maskManager.popMask(b),b.drawCount++,b.spriteBatch.start()}},a.Graphics.prototype._renderCanvas=function(b){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){var c=b.context,d=this.worldTransform;this.blendMode!==b.currentBlendMode&&(b.currentBlendMode=this.blendMode,c.globalCompositeOperation=a.blendModesCanvas[b.currentBlendMode]),c.setTransform(d.a,d.c,d.b,d.d,d.tx,d.ty),a.CanvasGraphics.renderGraphics(this,c);for(var e=0,f=this.children.length;f>e;e++)this.children[e]._renderCanvas(b)}},a.Graphics.prototype.getBounds=function(a){this.bounds||this.updateBounds();var b=this.bounds.x,c=this.bounds.width+this.bounds.x,d=this.bounds.y,e=this.bounds.height+this.bounds.y,f=a||this.worldTransform,g=f.a,h=f.c,i=f.b,j=f.d,k=f.tx,l=f.ty,m=g*c+i*e+k,n=j*e+h*c+l,o=g*b+i*e+k,p=j*e+h*b+l,q=g*b+i*d+k,r=j*d+h*b+l,s=g*c+i*d+k,t=j*d+h*c+l,u=-1/0,v=-1/0,w=1/0,x=1/0;w=w>m?m:w,w=w>o?o:w,w=w>q?q:w,w=w>s?s:w,x=x>n?n:x,x=x>p?p:x,x=x>r?r:x,x=x>t?t:x,u=m>u?m:u,u=o>u?o:u,u=q>u?q:u,u=s>u?s:u,v=n>v?n:v,v=p>v?p:v,v=r>v?r:v,v=t>v?t:v;var y=this._bounds;return y.x=w,y.width=u-w,y.y=x,y.height=v-x,y},a.Graphics.prototype.updateBounds=function(){for(var b,c,d,e,f,g=1/0,h=-1/0,i=1/0,j=-1/0,k=0;kc?c:g,h=c+e>h?c+e:h,i=i>d?c:i,j=d+f>j?d+f:j;else if(m===a.Graphics.CIRC||m===a.Graphics.ELIP)c=b[0],d=b[1],e=b[2]+n/2,f=b[3]+n/2,g=g>c-e?c-e:g,h=c+e>h?c+e:h,i=i>d-f?d-f:i,j=d+f>j?d+f:j;else for(var o=0;oc-n?c-n:g,h=c+n>h?c+n:h,i=i>d-n?d-n:i,j=d+n>j?d+n:j}var p=this.boundsPadding;this.bounds=new a.Rectangle(g-p,i-p,h-g+2*p,j-i+2*p)},a.Graphics.prototype._generateCachedSprite=function(){var b=this.getLocalBounds();if(this._cachedSprite)this._cachedSprite.buffer.resize(b.width,b.height);else{var c=new a.CanvasBuffer(b.width,b.height),d=a.Texture.fromCanvas(c.canvas);this._cachedSprite=new a.Sprite(d),this._cachedSprite.buffer=c,this._cachedSprite.worldTransform=this.worldTransform}this._cachedSprite.anchor.x=-(b.x/b.width),this._cachedSprite.anchor.y=-(b.y/b.height),this._cachedSprite.buffer.context.translate(-b.x,-b.y),a.CanvasGraphics.renderGraphics(this,this._cachedSprite.buffer.context)},a.Graphics.prototype.destroyCachedSprite=function(){this._cachedSprite.texture.destroy(!0),this._cachedSprite=null},a.Graphics.POLY=0,a.Graphics.RECT=1,a.Graphics.CIRC=2,a.Graphics.ELIP=3,a.TilingSprite=function(b,c,d){a.Sprite.call(this,b),this.width=c||100,this.height=d||100,this.tileScale=new a.Point(1,1),this.tileScaleOffset=new a.Point(1,1),this.tilePosition=new a.Point(0,0),this.renderable=!0,this.tint=16777215,this.blendMode=a.blendModes.NORMAL},a.TilingSprite.prototype=Object.create(a.Sprite.prototype),a.TilingSprite.prototype.constructor=a.TilingSprite,Object.defineProperty(a.TilingSprite.prototype,"width",{get:function(){return this._width},set:function(a){this._width=a}}),Object.defineProperty(a.TilingSprite.prototype,"height",{get:function(){return this._height},set:function(a){this._height=a}}),a.TilingSprite.prototype.onTextureUpdate=function(){this.updateFrame=!0},a.TilingSprite.prototype.setTexture=function(a){this.texture!==a&&(this.texture=a,this.refreshTexture=!0,this.cachedTint=16777215)},a.TilingSprite.prototype._renderWebGL=function(b){if(this.visible!==!1&&0!==this.alpha){var c,d;if(this.mask||this.filters){for(this.mask&&(b.spriteBatch.stop(),b.maskManager.pushMask(this.mask,b),b.spriteBatch.start()),this.filters&&(b.spriteBatch.flush(),b.filterManager.pushFilter(this._filterBlock)),!this.tilingTexture||this.refreshTexture?this.generateTilingTexture(!0):b.spriteBatch.renderTilingSprite(this),c=0,d=this.children.length;d>c;c++)this.children[c]._renderWebGL(b);b.spriteBatch.stop(),this.filters&&b.filterManager.popFilter(),this.mask&&b.maskManager.popMask(b),b.spriteBatch.start()}else for(!this.tilingTexture||this.refreshTexture?(this.generateTilingTexture(!0),this.tilingTexture.needsUpdate&&(a.updateWebGLTexture(this.tilingTexture.baseTexture,b.gl),this.tilingTexture.needsUpdate=!1)):b.spriteBatch.renderTilingSprite(this),c=0,d=this.children.length;d>c;c++)this.children[c]._renderWebGL(b)}},a.TilingSprite.prototype._renderCanvas=function(b){if(this.visible!==!1&&0!==this.alpha){var c=b.context;this._mask&&b.maskManager.pushMask(this._mask,c),c.globalAlpha=this.worldAlpha;var d=this.worldTransform;c.setTransform(d.a,d.c,d.b,d.d,d.tx,d.ty),(!this.__tilePattern||this.refreshTexture)&&(this.generateTilingTexture(!1),this.tilingTexture&&(this.__tilePattern=c.createPattern(this.tilingTexture.baseTexture.source,"repeat"))),this.blendMode!==b.currentBlendMode&&(b.currentBlendMode=this.blendMode,c.globalCompositeOperation=a.blendModesCanvas[b.currentBlendMode]),c.beginPath();var e=this.tilePosition,f=this.tileScale;e.x%=this.tilingTexture.baseTexture.width,e.y%=this.tilingTexture.baseTexture.height,c.scale(f.x,f.y),c.translate(e.x,e.y),c.fillStyle=this.__tilePattern,c.fillRect(-e.x,-e.y,this.width/f.x,this.height/f.y),c.scale(1/f.x,1/f.y),c.translate(-e.x,-e.y),c.closePath(),this._mask&&b.maskManager.popMask(b.context)}},a.TilingSprite.prototype.getBounds=function(){var a=this._width,b=this._height,c=a*(1-this.anchor.x),d=a*-this.anchor.x,e=b*(1-this.anchor.y),f=b*-this.anchor.y,g=this.worldTransform,h=g.a,i=g.c,j=g.b,k=g.d,l=g.tx,m=g.ty,n=h*d+j*f+l,o=k*f+i*d+m,p=h*c+j*f+l,q=k*f+i*c+m,r=h*c+j*e+l,s=k*e+i*c+m,t=h*d+j*e+l,u=k*e+i*d+m,v=-1/0,w=-1/0,x=1/0,y=1/0;x=x>n?n:x,x=x>p?p:x,x=x>r?r:x,x=x>t?t:x,y=y>o?o:y,y=y>q?q:y,y=y>s?s:y,y=y>u?u:y,v=n>v?n:v,v=p>v?p:v,v=r>v?r:v,v=t>v?t:v,w=o>w?o:w,w=q>w?q:w,w=s>w?s:w,w=u>w?u:w;var z=this._bounds;return z.x=x,z.width=v-x,z.y=y,z.height=w-y,this._currentBounds=z,z},a.TilingSprite.prototype.generateTilingTexture=function(b){var c=this.texture;if(c.baseTexture.hasLoaded){var d,e,f=c.baseTexture,g=c.frame,h=g.width!==f.width||g.height!==f.height,i=!1;if(b?(d=a.getNextPowerOfTwo(g.width),e=a.getNextPowerOfTwo(g.height),g.width!==d&&g.height!==e&&(i=!0)):h&&(c.trim?(d=c.trim.width,e=c.trim.height):(d=g.width,e=g.height),i=!0),i){var j;this.tilingTexture&&this.tilingTexture.isTiling?(j=this.tilingTexture.canvasBuffer,j.resize(d,e),this.tilingTexture.baseTexture.width=d,this.tilingTexture.baseTexture.height=e,this.tilingTexture.needsUpdate=!0):(j=new a.CanvasBuffer(d,e),this.tilingTexture=a.Texture.fromCanvas(j.canvas),this.tilingTexture.canvasBuffer=j,this.tilingTexture.isTiling=!0),j.context.drawImage(c.baseTexture.source,g.x,g.y,g.width,g.height,0,0,d,e),this.tileScaleOffset.x=g.width/d,this.tileScaleOffset.y=g.height/e}else this.tilingTexture&&this.tilingTexture.isTiling&&this.tilingTexture.destroy(!0),this.tileScaleOffset.x=1,this.tileScaleOffset.y=1,this.tilingTexture=c;this.refreshTexture=!1,this.tilingTexture.baseTexture._powerOf2=!0}},a.BaseTextureCache={},a.texturesToUpdate=[],a.texturesToDestroy=[],a.BaseTextureCacheIdGenerator=0,a.BaseTexture=function(b,c){if(a.EventTarget.call(this),this.width=100,this.height=100,this.scaleMode=c||a.scaleModes.DEFAULT,this.hasLoaded=!1,this.source=b,b){if(this.source.complete||this.source.getContext)this.hasLoaded=!0,this.width=this.source.width,this.height=this.source.height,a.texturesToUpdate.push(this);else{var d=this;this.source.onload=function(){d.hasLoaded=!0,d.width=d.source.width,d.height=d.source.height,a.texturesToUpdate.push(d),d.dispatchEvent({type:"loaded",content:d})}}this.imageUrl=null,this._powerOf2=!1,this.id=a.BaseTextureCacheIdGenerator++,this._glTextures=[]}},a.BaseTexture.prototype.constructor=a.BaseTexture,a.BaseTexture.prototype.destroy=function(){this.imageUrl&&(delete a.BaseTextureCache[this.imageUrl],this.imageUrl=null,this.source.src=null),this.source=null,a.texturesToDestroy.push(this)},a.BaseTexture.prototype.updateSourceImage=function(a){this.hasLoaded=!1,this.source.src=null,this.source.src=a -},a.BaseTexture.fromImage=function(b,c,d){var e=a.BaseTextureCache[b];if(c=!c,!e){var f=new Image;c&&(f.crossOrigin=""),f.src=b,e=new a.BaseTexture(f,d),e.imageUrl=b,a.BaseTextureCache[b]=e}return e},a.BaseTexture.fromCanvas=function(b,c){b._pixiId||(b._pixiId="canvas_"+a.TextureCacheIdGenerator++);var d=a.BaseTextureCache[b._pixiId];return d||(d=new a.BaseTexture(b,c),a.BaseTextureCache[b._pixiId]=d),d},a.TextureCache={},a.FrameCache={},a.TextureCacheIdGenerator=0,a.Texture=function(b,c){if(a.EventTarget.call(this),c||(this.noFrame=!0,c=new a.Rectangle(0,0,1,1)),b instanceof a.Texture&&(b=b.baseTexture),this.baseTexture=b,this.frame=c,this.trim=null,this.scope=this,this._uvs=null,b.hasLoaded)this.noFrame&&(c=new a.Rectangle(0,0,b.width,b.height)),this.setFrame(c);else{var d=this;b.addEventListener("loaded",function(){d.onBaseTextureLoaded()})}},a.Texture.prototype.constructor=a.Texture,a.Texture.prototype.onBaseTextureLoaded=function(){var b=this.baseTexture;b.removeEventListener("loaded",this.onLoaded),this.noFrame&&(this.frame=new a.Rectangle(0,0,b.width,b.height)),this.setFrame(this.frame),this.scope.dispatchEvent({type:"update",content:this})},a.Texture.prototype.destroy=function(a){a&&this.baseTexture.destroy()},a.Texture.prototype.setFrame=function(b){if(this.frame=b,this.width=b.width,this.height=b.height,b.x+b.width>this.baseTexture.width||b.y+b.height>this.baseTexture.height)throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.updateFrame=!0,a.Texture.frameUpdates.push(this)},a.Texture.prototype._updateWebGLuvs=function(){this._uvs||(this._uvs=new a.TextureUvs);var b=this.frame,c=this.baseTexture.width,d=this.baseTexture.height;this._uvs.x0=b.x/c,this._uvs.y0=b.y/d,this._uvs.x1=(b.x+b.width)/c,this._uvs.y1=b.y/d,this._uvs.x2=(b.x+b.width)/c,this._uvs.y2=(b.y+b.height)/d,this._uvs.x3=b.x/c,this._uvs.y3=(b.y+b.height)/d},a.Texture.fromImage=function(b,c,d){var e=a.TextureCache[b];return e||(e=new a.Texture(a.BaseTexture.fromImage(b,c,d)),a.TextureCache[b]=e),e},a.Texture.fromFrame=function(b){var c=a.TextureCache[b];if(!c)throw new Error('The frameId "'+b+'" does not exist in the texture cache ');return c},a.Texture.fromCanvas=function(b,c){var d=a.BaseTexture.fromCanvas(b,c);return new a.Texture(d)},a.Texture.addTextureToCache=function(b,c){a.TextureCache[c]=b},a.Texture.removeTextureFromCache=function(b){var c=a.TextureCache[b];return a.TextureCache[b]=null,c},a.Texture.frameUpdates=[],a.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y4=0},a.RenderTexture=function(b,c,d){if(a.EventTarget.call(this),this.width=b||100,this.height=c||100,this.frame=new a.Rectangle(0,0,this.width,this.height),this.baseTexture=new a.BaseTexture,this.baseTexture.width=this.width,this.baseTexture.height=this.height,this.baseTexture._glTextures=[],this.baseTexture.hasLoaded=!0,this.renderer=d||a.defaultRenderer,this.renderer.type===a.WEBGL_RENDERER){var e=this.renderer.gl;this.textureBuffer=new a.FilterTexture(e,this.width,this.height),this.baseTexture._glTextures[e.id]=this.textureBuffer.texture,this.render=this.renderWebGL,this.projection=new a.Point(this.width/2,-this.height/2)}else this.render=this.renderCanvas,this.textureBuffer=new a.CanvasBuffer(this.width,this.height),this.baseTexture.source=this.textureBuffer.canvas;a.Texture.frameUpdates.push(this)},a.RenderTexture.prototype=Object.create(a.Texture.prototype),a.RenderTexture.prototype.constructor=a.RenderTexture,a.RenderTexture.prototype.resize=function(b,c){if(this.width=b,this.height=c,this.frame.width=this.width,this.frame.height=this.height,this.renderer.type===a.WEBGL_RENDERER){this.projection.x=this.width/2,this.projection.y=-this.height/2;var d=this.renderer.gl;d.bindTexture(d.TEXTURE_2D,this.baseTexture._glTextures[d.id]),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,this.width,this.height,0,d.RGBA,d.UNSIGNED_BYTE,null)}else this.textureBuffer.resize(this.width,this.height);a.Texture.frameUpdates.push(this)},a.RenderTexture.prototype.renderWebGL=function(b,c,d){var e=this.renderer.gl;e.colorMask(!0,!0,!0,!0),e.viewport(0,0,this.width,this.height),e.bindFramebuffer(e.FRAMEBUFFER,this.textureBuffer.frameBuffer),d&&this.textureBuffer.clear();var f=b.children,g=b.worldTransform;b.worldTransform=a.RenderTexture.tempMatrix,b.worldTransform.d=-1,b.worldTransform.ty=-2*this.projection.y,c&&(b.worldTransform.tx=c.x,b.worldTransform.ty-=c.y);for(var h=0,i=f.length;i>h;h++)f[h].updateTransform();a.WebGLRenderer.updateTextures(),this.renderer.renderDisplayObject(b,this.projection,this.textureBuffer.frameBuffer),b.worldTransform=g},a.RenderTexture.prototype.renderCanvas=function(b,c,d){var e=b.children;b.worldTransform=a.RenderTexture.tempMatrix,c&&(b.worldTransform.tx=c.x,b.worldTransform.ty=c.y);for(var f=0,g=e.length;g>f;f++)e[f].updateTransform();d&&this.textureBuffer.clear();var h=this.textureBuffer.context;this.renderer.renderDisplayObject(b,h),h.setTransform(1,0,0,1,0,0)},a.RenderTexture.tempMatrix=new a.Matrix,b.Camera=function(a,c,d,e,f,g){this.game=a,this.world=a.world,this.id=0,this.view=new b.Rectangle(d,e,f,g),this.screenView=new b.Rectangle(d,e,f,g),this.bounds=new b.Rectangle(d,e,f,g),this.deadzone=null,this.visible=!0,this.atLimit={x:!1,y:!1},this.target=null,this._edge=0,this.displayObject=null},b.Camera.FOLLOW_LOCKON=0,b.Camera.FOLLOW_PLATFORMER=1,b.Camera.FOLLOW_TOPDOWN=2,b.Camera.FOLLOW_TOPDOWN_TIGHT=3,b.Camera.prototype={follow:function(a,c){"undefined"==typeof c&&(c=b.Camera.FOLLOW_LOCKON),this.target=a;var d;switch(c){case b.Camera.FOLLOW_PLATFORMER:var e=this.width/8,f=this.height/3;this.deadzone=new b.Rectangle((this.width-e)/2,(this.height-f)/2-.25*f,e,f);break;case b.Camera.FOLLOW_TOPDOWN:d=Math.max(this.width,this.height)/4,this.deadzone=new b.Rectangle((this.width-d)/2,(this.height-d)/2,d,d);break;case b.Camera.FOLLOW_TOPDOWN_TIGHT:d=Math.max(this.width,this.height)/8,this.deadzone=new b.Rectangle((this.width-d)/2,(this.height-d)/2,d,d);break;case b.Camera.FOLLOW_LOCKON:this.deadzone=null;break;default:this.deadzone=null}},focusOn:function(a){this.setPosition(Math.round(a.x-this.view.halfWidth),Math.round(a.y-this.view.halfHeight))},focusOnXY:function(a,b){this.setPosition(Math.round(a-this.view.halfWidth),Math.round(b-this.view.halfHeight))},update:function(){this.target&&this.updateTarget(),this.bounds&&this.checkBounds(),this.displayObject.position.x=-this.view.x,this.displayObject.position.y=-this.view.y},updateTarget:function(){this.deadzone?(this._edge=this.target.x-this.deadzone.x,this.view.x>this._edge&&(this.view.x=this._edge),this._edge=this.target.x+this.target.width-this.deadzone.x-this.deadzone.width,this.view.xthis._edge&&(this.view.y=this._edge),this._edge=this.target.y+this.target.height-this.deadzone.y-this.deadzone.height,this.view.ythis.bounds.right&&(this.atLimit.x=!0,this.view.x=this.bounds.right-this.width),this.view.ythis.bounds.bottom&&(this.atLimit.y=!0,this.view.y=this.bounds.bottom-this.height),this.view.floor()},setPosition:function(a,b){this.view.x=a,this.view.y=b,this.bounds&&this.checkBounds()},setSize:function(a,b){this.view.width=a,this.view.height=b},reset:function(){this.target=null,this.view.x=0,this.view.y=0}},b.Camera.prototype.constructor=b.Camera,Object.defineProperty(b.Camera.prototype,"x",{get:function(){return this.view.x},set:function(a){this.view.x=a,this.bounds&&this.checkBounds()}}),Object.defineProperty(b.Camera.prototype,"y",{get:function(){return this.view.y},set:function(a){this.view.y=a,this.bounds&&this.checkBounds()}}),Object.defineProperty(b.Camera.prototype,"width",{get:function(){return this.view.width},set:function(a){this.view.width=a}}),Object.defineProperty(b.Camera.prototype,"height",{get:function(){return this.view.height},set:function(a){this.view.height=a}}),b.State=function(){this.game=null,this.add=null,this.camera=null,this.cache=null,this.input=null,this.load=null,this.math=null,this.sound=null,this.stage=null,this.time=null,this.tweens=null,this.world=null,this.particles=null,this.physics=null},b.State.prototype={preload:function(){},loadUpdate:function(){},loadRender:function(){},create:function(){},update:function(){},render:function(){},paused:function(){},destroy:function(){}},b.State.prototype.constructor=b.State,b.StateManager=function(a,b){this.game=a,this.states={},this._pendingState=null,"undefined"!=typeof b&&null!==b&&(this._pendingState=b),this._created=!1,this.current="",this.onInitCallback=null,this.onPreloadCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onRenderCallback=null,this.onPreRenderCallback=null,this.onLoadUpdateCallback=null,this.onLoadRenderCallback=null,this.onPausedCallback=null,this.onShutDownCallback=null},b.StateManager.prototype={boot:function(){this.game.onPause.add(this.pause,this),this.game.onResume.add(this.resume,this),null!==this._pendingState&&("string"==typeof this._pendingState?this.start(this._pendingState,!1,!1):this.add("default",this._pendingState,!0))},add:function(a,c,d){"undefined"==typeof d&&(d=!1);var e;return c instanceof b.State?e=c:"object"==typeof c?(e=c,e.game=this.game):"function"==typeof c&&(e=new c(this.game)),this.states[a]=e,d&&(this.game.isBooted?this.start(a):this._pendingState=a),e},remove:function(a){this.current==a&&(this.callbackContext=null,this.onInitCallback=null,this.onShutDownCallback=null,this.onPreloadCallback=null,this.onLoadRenderCallback=null,this.onLoadUpdateCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onRenderCallback=null,this.onPausedCallback=null,this.onDestroyCallback=null),delete this.states[a]},start:function(a,b,c){return"undefined"==typeof b&&(b=!0),"undefined"==typeof c&&(c=!1),this.game.isBooted===!1?(this._pendingState=a,void 0):(this.checkState(a)!==!1&&(this.current&&this.onShutDownCallback.call(this.callbackContext,this.game),b&&(this.game.tweens.removeAll(),this.game.world.destroy(),c===!0&&this.game.cache.destroy()),this.setCurrentState(a),this.onPreloadCallback?(this.game.load.reset(),this.onPreloadCallback.call(this.callbackContext,this.game),0===this.game.load.totalQueuedFiles()?this.game.loadComplete():this.game.load.start()):this.game.loadComplete()),void 0)},dummy:function(){},checkState:function(a){if(this.states[a]){var b=!1;return this.states[a].preload&&(b=!0),b===!1&&this.states[a].loadRender&&(b=!0),b===!1&&this.states[a].loadUpdate&&(b=!0),b===!1&&this.states[a].create&&(b=!0),b===!1&&this.states[a].update&&(b=!0),b===!1&&this.states[a].preRender&&(b=!0),b===!1&&this.states[a].render&&(b=!0),b===!1&&this.states[a].paused&&(b=!0),b===!1?(console.warn("Invalid Phaser State object given. Must contain at least a one of the required functions."),!1):!0}return console.warn("Phaser.StateManager - No state found with the key: "+a),!1},link:function(a){this.states[a].game=this.game,this.states[a].add=this.game.add,this.states[a].camera=this.game.camera,this.states[a].cache=this.game.cache,this.states[a].input=this.game.input,this.states[a].load=this.game.load,this.states[a].math=this.game.math,this.states[a].sound=this.game.sound,this.states[a].scale=this.game.scale,this.states[a].stage=this.game.stage,this.states[a].time=this.game.time,this.states[a].tweens=this.game.tweens,this.states[a].world=this.game.world,this.states[a].particles=this.game.particles,this.states[a].physics=this.game.physics,this.states[a].rnd=this.game.rnd},setCurrentState:function(a){this.callbackContext=this.states[a],this.link(a),this.onInitCallback=this.states[a].init||this.dummy,this.onPreloadCallback=this.states[a].preload||null,this.onLoadRenderCallback=this.states[a].loadRender||null,this.onLoadUpdateCallback=this.states[a].loadUpdate||null,this.onCreateCallback=this.states[a].create||null,this.onUpdateCallback=this.states[a].update||null,this.onPreRenderCallback=this.states[a].preRender||null,this.onRenderCallback=this.states[a].render||null,this.onPausedCallback=this.states[a].paused||null,this.onShutDownCallback=this.states[a].shutdown||this.dummy,this.current=a,this._created=!1,this.onInitCallback.call(this.callbackContext,this.game)},getCurrentState:function(){return this.states[this.current]},loadComplete:function(){this._created===!1&&this.onCreateCallback?(this._created=!0,this.onCreateCallback.call(this.callbackContext,this.game)):this._created=!0},pause:function(){this._created&&this.onPausedCallback&&this.onPausedCallback.call(this.callbackContext,this.game,!0)},resume:function(){this._created&&this.onre&&this.onPausedCallback.call(this.callbackContext,this.game,!1)},update:function(){this._created&&this.onUpdateCallback?this.onUpdateCallback.call(this.callbackContext,this.game):this.onLoadUpdateCallback&&this.onLoadUpdateCallback.call(this.callbackContext,this.game)},preRender:function(){this.onPreRenderCallback&&this.onPreRenderCallback.call(this.callbackContext,this.game)},render:function(){this._created&&this.onRenderCallback?(this.game.renderType===b.CANVAS&&(this.game.context.save(),this.game.context.setTransform(1,0,0,1,0,0)),this.onRenderCallback.call(this.callbackContext,this.game),this.game.renderType===b.CANVAS&&this.game.context.restore()):this.onLoadRenderCallback&&this.onLoadRenderCallback.call(this.callbackContext,this.game)},destroy:function(){this.callbackContext=null,this.onInitCallback=null,this.onShutDownCallback=null,this.onPreloadCallback=null,this.onLoadRenderCallback=null,this.onLoadUpdateCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onRenderCallback=null,this.onPausedCallback=null,this.onDestroyCallback=null,this.game=null,this.states={},this._pendingState=null}},b.StateManager.prototype.constructor=b.StateManager,b.LinkedList=function(){this.next=null,this.prev=null,this.first=null,this.last=null,this.total=0},b.LinkedList.prototype={add:function(a){return 0===this.total&&null==this.first&&null==this.last?(this.first=a,this.last=a,this.next=a,a.prev=this,this.total++,a):(this.last.next=a,a.prev=this.last,this.last=a,this.total++,a)},remove:function(a){a==this.first?this.first=this.first.next:a==this.last&&(this.last=this.last.prev),a.prev&&(a.prev.next=a.next),a.next&&(a.next.prev=a.prev),a.next=a.prev=null,null==this.first&&(this.last=null),this.total--},callAll:function(a){if(this.first&&this.last){var b=this.first;do b&&b[a]&&b[a].call(b),b=b.next;while(b!=this.last.next)}}},b.LinkedList.prototype.constructor=b.LinkedList,b.Signal=function(){this._bindings=[],this._prevParams=null;var a=this;this.dispatch=function(){b.Signal.prototype.dispatch.apply(a,arguments)}},b.Signal.prototype={memorize:!1,_shouldPropagate:!0,active:!0,validateListener:function(a,b){if("function"!=typeof a)throw new Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",b))},_registerListener:function(a,c,d,e){var f,g=this._indexOfListener(a,d);if(-1!==g){if(f=this._bindings[g],f.isOnce()!==c)throw new Error("You cannot add"+(c?"":"Once")+"() then add"+(c?"Once":"")+"() the same listener without removing the relationship first.")}else f=new b.SignalBinding(this,a,c,d,e),this._addBinding(f);return this.memorize&&this._prevParams&&f.execute(this._prevParams),f},_addBinding:function(a){var b=this._bindings.length;do--b;while(this._bindings[b]&&a._priority<=this._bindings[b]._priority);this._bindings.splice(b+1,0,a)},_indexOfListener:function(a,b){for(var c,d=this._bindings.length;d--;)if(c=this._bindings[d],c._listener===a&&c.context===b)return d;return-1},has:function(a,b){return-1!==this._indexOfListener(a,b)},add:function(a,b,c){return this.validateListener(a,"add"),this._registerListener(a,!1,b,c)},addOnce:function(a,b,c){return this.validateListener(a,"addOnce"),this._registerListener(a,!0,b,c)},remove:function(a,b){this.validateListener(a,"remove");var c=this._indexOfListener(a,b);return-1!==c&&(this._bindings[c]._destroy(),this._bindings.splice(c,1)),a},removeAll:function(){for(var a=this._bindings.length;a--;)this._bindings[a]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(){if(this.active){var a,b=Array.prototype.slice.call(arguments),c=this._bindings.length;if(this.memorize&&(this._prevParams=b),c){a=this._bindings.slice(),this._shouldPropagate=!0;do c--;while(a[c]&&this._shouldPropagate&&a[c].execute(b)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),delete this._bindings,delete this._prevParams},toString:function(){return"[Phaser.Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}},b.Signal.prototype.constructor=b.Signal,b.SignalBinding=function(a,b,c,d,e){this._listener=b,this._isOnce=c,this.context=d,this._signal=a,this._priority=e||0},b.SignalBinding.prototype={active:!0,params:null,execute:function(a){var b,c;return this.active&&this._listener&&(c=this.params?this.params.concat(a):a,b=this._listener.apply(this.context,c),this._isOnce&&this.detach()),b},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return"[Phaser.SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},b.SignalBinding.prototype.constructor=b.SignalBinding,b.Filter=function(a,c,d){this.game=a,this.type=b.WEBGL_FILTER,this.passes=[this],this.shaders=[],this.dirty=!0,this.padding=0,this.uniforms={time:{type:"1f",value:0},resolution:{type:"2f",value:{x:256,y:256}},mouse:{type:"2f",value:{x:0,y:0}}},this.fragmentSrc=d||[]},b.Filter.prototype={init:function(){},setResolution:function(a,b){this.uniforms.resolution.value.x=a,this.uniforms.resolution.value.y=b},update:function(a){"undefined"!=typeof a&&(a.x>0&&(this.uniforms.mouse.x=a.x.toFixed(2)),a.y>0&&(this.uniforms.mouse.y=a.y.toFixed(2))),this.uniforms.time.value=this.game.time.totalElapsedSeconds()},destroy:function(){this.game=null}},b.Filter.prototype.constructor=b.Filter,Object.defineProperty(b.Filter.prototype,"width",{get:function(){return this.uniforms.resolution.value.x},set:function(a){this.uniforms.resolution.value.x=a}}),Object.defineProperty(b.Filter.prototype,"height",{get:function(){return this.uniforms.resolution.value.y},set:function(a){this.uniforms.resolution.value.y=a}}),b.Plugin=function(a,b){"undefined"==typeof b&&(b=null),this.game=a,this.parent=b,this.active=!1,this.visible=!1,this.hasPreUpdate=!1,this.hasUpdate=!1,this.hasPostUpdate=!1,this.hasRender=!1,this.hasPostRender=!1},b.Plugin.prototype={preUpdate:function(){},update:function(){},render:function(){},postRender:function(){},destroy:function(){this.game=null,this.parent=null,this.active=!1,this.visible=!1}},b.Plugin.prototype.constructor=b.Plugin,b.PluginManager=function(a,b){this.game=a,this._parent=b,this.plugins=[],this._pluginsLength=0},b.PluginManager.prototype={add:function(a){var b=!1;return"function"==typeof a?a=new a(this.game,this._parent):(a.game=this.game,a.parent=this._parent),"function"==typeof a.preUpdate&&(a.hasPreUpdate=!0,b=!0),"function"==typeof a.update&&(a.hasUpdate=!0,b=!0),"function"==typeof a.postUpdate&&(a.hasPostUpdate=!0,b=!0),"function"==typeof a.render&&(a.hasRender=!0,b=!0),"function"==typeof a.postRender&&(a.hasPostRender=!0,b=!0),b?((a.hasPreUpdate||a.hasUpdate||a.hasPostUpdate)&&(a.active=!0),(a.hasRender||a.hasPostRender)&&(a.visible=!0),this._pluginsLength=this.plugins.push(a),"function"==typeof a.init&&a.init(),a):null},remove:function(a){if(0!==this._pluginsLength)for(this._p=0;this._pthis._nextOffsetCheck&&(b.Canvas.getOffset(this.game.canvas,this.offset),this._nextOffsetCheck=this.game.time.now+this.checkOffsetInterval)},b.Stage.prototype.visibilityChange=function(a){this.disableVisibilityChange||(this.game.paused=this.game.paused!==!1||"pagehide"!=a.type&&"blur"!=a.type&&document.hidden!==!0&&document.webkitHidden!==!0?!1:!0)},b.Stage.prototype.setBackgroundColor=function(b){this._backgroundColor=b||0,this.backgroundColorSplit=a.hex2rgb(this.backgroundColor);var c=this._backgroundColor.toString(16);c="000000".substr(0,6-c.length)+c,this.backgroundColorString="#"+c},Object.defineProperty(b.Stage.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(a){this._backgroundColor=a,this.game.transparent===!1&&("string"==typeof a&&(a=b.Color.hexToRGB(a)),this.setBackgroundColor(a))}}),b.Group=function(c,d,e,f){this.game=c,("undefined"==typeof d||null===d)&&(d=c.world),this.name=e||"group",a.DisplayObjectContainer.call(this),"undefined"==typeof f||f===!1?d?d.addChild(this):this.game.stage.addChild(this):this.game.stage.addChild(this),this.type=b.GROUP,this.alive=!0,this.exists=!0,this.scale=new b.Point(1,1),this.cursor=null,this._cursorIndex=0,this.cameraOffset=new b.Point,this._cache=new Int16Array([0,0,0,0,1,0,1,0])},b.Group.prototype=Object.create(a.DisplayObjectContainer.prototype),b.Group.prototype.constructor=b.Group,b.Group.RETURN_NONE=0,b.Group.RETURN_TOTAL=1,b.Group.RETURN_CHILD=2,b.Group.SORT_ASCENDING=-1,b.Group.SORT_DESCENDING=1,b.Group.prototype.add=function(a){return a.parent!==this&&(this.addChild(a),a.events&&a.events.onAddedToGroup.dispatch(a,this)),null===this.cursor&&(this.cursor=a),a},b.Group.prototype.addAt=function(a,b){return a.parent!==this&&(this.addChildAt(a,b),a.events&&a.events.onAddedToGroup.dispatch(a,this)),null===this.cursor&&(this.cursor=a),a},b.Group.prototype.getAt=function(a){return this.getChildAt(a)},b.Group.prototype.create=function(a,c,d,e,f){"undefined"==typeof f&&(f=!0);var g=new b.Sprite(this.game,a,c,d,e);return g.exists=f,g.visible=f,g.alive=f,this.addChild(g),g.events&&g.events.onAddedToGroup.dispatch(g,this),null===this.cursor&&(this.cursor=g),g},b.Group.prototype.createMultiple=function(a,b,c,d){"undefined"==typeof d&&(d=!1);for(var e=0;a>e;e++)this.create(0,0,b,c,d)},b.Group.prototype.next=function(){this.cursor&&(this._cursorIndex===this.children.length?this._cursorIndex=0:this._cursorIndex++,this.cursor=this.children[this._cursorIndex])},b.Group.prototype.previous=function(){this.cursor&&(0===this._cursorIndex?this._cursorIndex=this.children.length-1:this._cursorIndex--,this.cursor=this.children[this._cursorIndex])},b.Group.prototype.swap=function(a,b){return this.swapChildren(a,b)},b.Group.prototype.bringToTop=function(a){return a.parent===this&&(this.remove(a),this.add(a)),a},b.Group.prototype.getIndex=function(a){return this.children.indexOf(a)},b.Group.prototype.replace=function(a,b){var c=this.getIndex(a);-1!==c&&(void 0!==b.parent&&(b.events.onRemovedFromGroup.dispatch(b,this),b.parent.removeChild(b)),this.removeChild(a),this.addChildAt(b,c),b.events.onAddedToGroup.dispatch(b,this),this.cursor===a&&(this.cursor=b))},b.Group.prototype.setProperty=function(a,b,c,d){d=d||0;var e=b.length;1==e?0===d?a[b[0]]=c:1==d?a[b[0]]+=c:2==d?a[b[0]]-=c:3==d?a[b[0]]*=c:4==d&&(a[b[0]]/=c):2==e?0===d?a[b[0]][b[1]]=c:1==d?a[b[0]][b[1]]+=c:2==d?a[b[0]][b[1]]-=c:3==d?a[b[0]][b[1]]*=c:4==d&&(a[b[0]][b[1]]/=c):3==e?0===d?a[b[0]][b[1]][b[2]]=c:1==d?a[b[0]][b[1]][b[2]]+=c:2==d?a[b[0]][b[1]][b[2]]-=c:3==d?a[b[0]][b[1]][b[2]]*=c:4==d&&(a[b[0]][b[1]][b[2]]/=c):4==e&&(0===d?a[b[0]][b[1]][b[2]][b[3]]=c:1==d?a[b[0]][b[1]][b[2]][b[3]]+=c:2==d?a[b[0]][b[1]][b[2]][b[3]]-=c:3==d?a[b[0]][b[1]][b[2]][b[3]]*=c:4==d&&(a[b[0]][b[1]][b[2]][b[3]]/=c))},b.Group.prototype.set=function(a,b,c,d,e,f){b=b.split("."),"undefined"==typeof d&&(d=!1),"undefined"==typeof e&&(e=!1),(d===!1||d&&a.alive)&&(e===!1||e&&a.visible)&&this.setProperty(a,b,c,f)},b.Group.prototype.setAll=function(a,b,c,d,e){a=a.split("."),"undefined"==typeof c&&(c=!1),"undefined"==typeof d&&(d=!1),e=e||0;for(var f=0,g=this.children.length;g>f;f++)(!c||c&&this.children[f].alive)&&(!d||d&&this.children[f].visible)&&this.setProperty(this.children[f],a,b,e)},b.Group.prototype.addAll=function(a,b,c,d){this.setAll(a,b,c,d,1)},b.Group.prototype.subAll=function(a,b,c,d){this.setAll(a,b,c,d,2)},b.Group.prototype.multiplyAll=function(a,b,c,d){this.setAll(a,b,c,d,3)},b.Group.prototype.divideAll=function(a,b,c,d){this.setAll(a,b,c,d,4)},b.Group.prototype.callAllExists=function(a,b){for(var c=Array.prototype.splice.call(arguments,2),d=0,e=this.children.length;e>d;d++)this.children[d].exists===b&&this.children[d][a]&&this.children[d][a].apply(this.children[d],c)},b.Group.prototype.callbackFromArray=function(a,b,c){if(1==c){if(a[b[0]])return a[b[0]]}else if(2==c){if(a[b[0]][b[1]])return a[b[0]][b[1]]}else if(3==c){if(a[b[0]][b[1]][b[2]])return a[b[0]][b[1]][b[2]]}else if(4==c){if(a[b[0]][b[1]][b[2]][b[3]])return a[b[0]][b[1]][b[2]][b[3]]}else if(a[b])return a[b];return!1},b.Group.prototype.callAll=function(a,b){if("undefined"!=typeof a){a=a.split(".");var c=a.length;if("undefined"==typeof b)b=null;else if("string"==typeof b){b=b.split(".");var d=b.length}for(var e=Array.prototype.splice.call(arguments,2),f=null,g=null,h=0,i=this.children.length;i>h;h++)f=this.callbackFromArray(this.children[h],a,c),b&&f?(g=this.callbackFromArray(this.children[h],b,d),f&&f.apply(g,e)):f&&f.apply(this.children[h],e)}},b.Group.prototype.preUpdate=function(){if(!this.exists||!this.parent.exists)return this.renderOrderID=-1,!1;for(var a=this.children.length;a--;)this.children[a].preUpdate();return!0},b.Group.prototype.update=function(){for(var a=this.children.length;a--;)this.children[a].update()},b.Group.prototype.postUpdate=function(){1===this._cache[7]&&(this.x=this.game.camera.view.x+this.cameraOffset.x,this.y=this.game.camera.view.y+this.cameraOffset.y);for(var a=this.children.length;a--;)this.children[a].postUpdate()},b.Group.prototype.forEach=function(a,b,c){"undefined"==typeof c&&(c=!1);var d=Array.prototype.splice.call(arguments,3);d.unshift(null);for(var e=0,f=this.children.length;f>e;e++)(!c||c&&this.children[e].exists)&&(d[0]=this.children[e],a.apply(b,d))},b.Group.prototype.forEachExists=function(a,c){var d=Array.prototype.splice.call(arguments,2);d.unshift(null),this.iterate("exists",!0,b.Group.RETURN_TOTAL,a,c,d)},b.Group.prototype.forEachAlive=function(a,c){var d=Array.prototype.splice.call(arguments,2);d.unshift(null),this.iterate("alive",!0,b.Group.RETURN_TOTAL,a,c,d)},b.Group.prototype.forEachDead=function(a,c){var d=Array.prototype.splice.call(arguments,2);d.unshift(null),this.iterate("alive",!1,b.Group.RETURN_TOTAL,a,c,d)},b.Group.prototype.sort=function(a,c){"undefined"==typeof a&&(a="y"),"undefined"==typeof c&&(c=b.Group.SORT_ASCENDING)},b.Group.prototype.sortHandler=function(){},b.Group.prototype.iterate=function(a,c,d,e,f,g){if(d===b.Group.RETURN_TOTAL&&0===this.children.length)return 0;"undefined"==typeof e&&(e=!1);for(var h=0,i=0,j=this.children.length;j>i;i++)if(this.children[i][a]===c&&(h++,e&&(g[0]=this.children[i],e.apply(f,g)),d===b.Group.RETURN_CHILD))return this.children[i];return d===b.Group.RETURN_TOTAL?h:d===b.Group.RETURN_CHILD?null:void 0},b.Group.prototype.getFirstExists=function(a){return"boolean"!=typeof a&&(a=!0),this.iterate("exists",a,b.Group.RETURN_CHILD)},b.Group.prototype.getFirstAlive=function(){return this.iterate("alive",!0,b.Group.RETURN_CHILD)},b.Group.prototype.getFirstDead=function(){return this.iterate("alive",!1,b.Group.RETURN_CHILD)},b.Group.prototype.countLiving=function(){return this.iterate("alive",!0,b.Group.RETURN_TOTAL)},b.Group.prototype.countDead=function(){return this.iterate("alive",!1,b.Group.RETURN_TOTAL) -},b.Group.prototype.getRandom=function(a,b){return 0===this.children.length?null:(a=a||0,b=b||this.children.length,this.game.math.getRandom(this.children,a,b))},b.Group.prototype.remove=function(a){return 0!==this.children.length?(a.events&&a.events.onRemovedFromGroup.dispatch(a,this),this.removeChild(a),this.cursor===a&&this.next(),!0):void 0},b.Group.prototype.removeAll=function(){if(0!==this.children.length){do 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}},b.Group.prototype.removeBetween=function(a,b){if(0!==this.children.length){if(a>b||0>a||b>this.children.length)return!1;for(var c=a;b>c;c++)this.children[c].events&&this.children[c].events.onRemovedFromGroup.dispatch(this.children[c],this),this.removeChild(this.children[c]),this.cursor===child&&(this.cursor=null)}},b.Group.prototype.destroy=function(a){if("undefined"==typeof a&&(a=!1),a){if(this.children.length>0)do 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=!1,this.cursor=null},Object.defineProperty(b.Group.prototype,"total",{get:function(){return this.iterate("exists",!0,b.Group.RETURN_TOTAL)}}),Object.defineProperty(b.Group.prototype,"length",{get:function(){return this.children.length}}),Object.defineProperty(b.Group.prototype,"angle",{get:function(){return b.Math.radToDeg(this.rotation)},set:function(a){this.rotation=b.Math.degToRad(a)}}),Object.defineProperty(b.Group.prototype,"fixedToCamera",{get:function(){return!!this._cache[7]},set:function(a){a?(this._cache[7]=1,this.cameraOffset.set(this.x,this.y)):this._cache[7]=0}}),b.World=function(a){b.Group.call(this,a,null,"__world",!1),this.bounds=new b.Rectangle(0,0,a.width,a.height),this.camera=null,this.currentRenderOrderID=0},b.World.prototype=Object.create(b.Group.prototype),b.World.prototype.constructor=b.World,b.World.prototype.boot=function(){this.camera=new b.Camera(this.game,0,0,0,this.game.width,this.game.height),this.camera.displayObject=this,this.game.camera=this.camera,this.game.stage.addChild(this)},b.World.prototype.setBounds=function(a,b,c,d){c0;c--)null===this["pointer"+c]&&(a=c);return 0===a?(console.warn("You can only have 10 Pointer objects"),null):(this["pointer"+a]=new b.Pointer(this.game,a),this["pointer"+a])},update:function(){return this.pollRate>0&&this._pollCounter=c;c++)this["pointer"+c]&&this["pointer"+c].reset();this.currentPointers=0,"none"!==this.game.canvas.style.cursor&&(this.game.canvas.style.cursor="inherit"),a===!0&&(this.onDown.dispose(),this.onUp.dispose(),this.onTap.dispose(),this.onHold.dispose(),this.onDown=new b.Signal,this.onUp=new b.Signal,this.onTap=new b.Signal,this.onHold=new b.Signal,this.interactiveItems.callAll("reset")),this._pollCounter=0}},resetSpeed:function(a,b){this._oldPosition.setTo(a,b),this.speed.setTo(0,0)},startPointer:function(a){if(this.maxPointers<10&&this.totalActivePointers==this.maxPointers)return null;if(this.pointer1.active===!1)return this.pointer1.start(a);if(this.pointer2.active===!1)return this.pointer2.start(a);for(var b=3;10>=b;b++)if(this["pointer"+b]&&this["pointer"+b].active===!1)return this["pointer"+b].start(a);return null},updatePointer:function(a){if(this.pointer1.active&&this.pointer1.identifier==a.identifier)return this.pointer1.move(a);if(this.pointer2.active&&this.pointer2.identifier==a.identifier)return this.pointer2.move(a);for(var b=3;10>=b;b++)if(this["pointer"+b]&&this["pointer"+b].active&&this["pointer"+b].identifier==a.identifier)return this["pointer"+b].move(a);return null},stopPointer:function(a){if(this.pointer1.active&&this.pointer1.identifier==a.identifier)return this.pointer1.stop(a);if(this.pointer2.active&&this.pointer2.identifier==a.identifier)return this.pointer2.stop(a);for(var b=3;10>=b;b++)if(this["pointer"+b]&&this["pointer"+b].active&&this["pointer"+b].identifier==a.identifier)return this["pointer"+b].stop(a);return null},getPointer:function(a){if(a=a||!1,this.pointer1.active==a)return this.pointer1;if(this.pointer2.active==a)return this.pointer2;for(var b=3;10>=b;b++)if(this["pointer"+b]&&this["pointer"+b].active==a)return this["pointer"+b];return null},getPointerFromIdentifier:function(a){if(this.pointer1.identifier==a)return this.pointer1;if(this.pointer2.identifier==a)return this.pointer2;for(var b=3;10>=b;b++)if(this["pointer"+b]&&this["pointer"+b].identifier==a)return this["pointer"+b];return null},getLocalPosition:function(a,c,d){"undefined"==typeof d&&(d=new b.Point);var e=a.worldTransform,f=1/(e.a*e.d+e.b*-e.c);return d.setTo(e.d*f*c.x+-e.b*f*c.y+(e.ty*e.b-e.tx*e.d)*f,e.a*f*c.y+-e.c*f*c.x+(-e.ty*e.a+e.tx*e.c)*f)},hitTest:function(b,c,d){if(!b.worldVisible)return!1;if(this.getLocalPosition(b,c,this._localPoint),d.copyFrom(this._localPoint),b.hitArea&&b.hitArea.contains)return b.hitArea.contains(this._localPoint.x,this._localPoint.y)?!0:!1;if(b instanceof a.Sprite){var e=b.texture.frame.width,f=b.texture.frame.height,g=-e*b.anchor.x;if(this._localPoint.x>g&&this._localPoint.xh&&this._localPoint.yi;i++)if(this.hitTest(b.children[i],c,d))return!0;return!1}},b.Input.prototype.constructor=b.Input,Object.defineProperty(b.Input.prototype,"x",{get:function(){return this._x},set:function(a){this._x=Math.floor(a)}}),Object.defineProperty(b.Input.prototype,"y",{get:function(){return this._y},set:function(a){this._y=Math.floor(a)}}),Object.defineProperty(b.Input.prototype,"pollLocked",{get:function(){return this.pollRate>0&&this._pollCounter=a;a++)this["pointer"+a]&&this["pointer"+a].active&&this.currentPointers++;return this.currentPointers}}),Object.defineProperty(b.Input.prototype,"worldX",{get:function(){return this.game.camera.view.x+this.x}}),Object.defineProperty(b.Input.prototype,"worldY",{get:function(){return this.game.camera.view.y+this.y}}),b.Key=function(a,c){this.game=a,this.isDown=!1,this.isUp=!1,this.altKey=!1,this.ctrlKey=!1,this.shiftKey=!1,this.timeDown=0,this.duration=0,this.timeUp=0,this.repeats=0,this.keyCode=c,this.onDown=new b.Signal,this.onUp=new b.Signal},b.Key.prototype={processKeyDown:function(a){this.altKey=a.altKey,this.ctrlKey=a.ctrlKey,this.shiftKey=a.shiftKey,this.isDown?(this.duration=a.timeStamp-this.timeDown,this.repeats++):(this.isDown=!0,this.isUp=!1,this.timeDown=a.timeStamp,this.duration=0,this.repeats=0,this.onDown.dispatch(this))},processKeyUp:function(a){this.isDown=!1,this.isUp=!0,this.timeUp=a.timeStamp,this.onUp.dispatch(this)},justPressed:function(a){return"undefined"==typeof a&&(a=250),this.isDown&&this.duration=this.game.input.holdRate&&((this.game.input.multiInputOverride==b.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==b.Input.MOUSE_TOUCH_COMBINE||this.game.input.multiInputOverride==b.Input.TOUCH_OVERRIDES_MOUSE&&0===this.game.input.currentPointers)&&this.game.input.onHold.dispatch(this),this._holdSent=!0),this.game.input.recordPointerHistory&&this.game.time.now>=this._nextDrop&&(this._nextDrop=this.game.time.now+this.game.input.recordRate,this._history.push({x:this.position.x,y:this.position.y}),this._history.length>this.game.input.recordLimit&&this._history.shift()))},move:function(a,c){if(!this.game.input.pollLocked){if("undefined"==typeof c&&(c=!1),"undefined"!=typeof a.button&&(this.button=a.button),this.clientX=a.clientX,this.clientY=a.clientY,this.pageX=a.pageX,this.pageY=a.pageY,this.screenX=a.screenX,this.screenY=a.screenY,this.x=(this.pageX-this.game.stage.offset.x)*this.game.input.scale.x,this.y=(this.pageY-this.game.stage.offset.y)*this.game.input.scale.y,this.position.setTo(this.x,this.y),this.circle.x=this.x,this.circle.y=this.y,(this.game.input.multiInputOverride==b.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==b.Input.MOUSE_TOUCH_COMBINE||this.game.input.multiInputOverride==b.Input.TOUCH_OVERRIDES_MOUSE&&0===this.game.input.currentPointers)&&(this.game.input.activePointer=this,this.game.input.x=this.x,this.game.input.y=this.y,this.game.input.position.setTo(this.game.input.x,this.game.input.y),this.game.input.circle.x=this.game.input.x,this.game.input.circle.y=this.game.input.y),this.game.paused)return this;if(this.game.input.moveCallback&&this.game.input.moveCallback.call(this.game.input.moveCallbackContext,this,this.x,this.y),null!==this.targetObject&&this.targetObject.isDragged===!0)return this.targetObject.update(this)===!1&&(this.targetObject=null),this;if(this._highestRenderOrderID=-1,this._highestRenderObject=null,this._highestInputPriorityID=-1,this.game.input.interactiveItems.total>0){var d=this.game.input.interactiveItems.next;do(d.pixelPerfectClick||d.pixelPerfectOver||d.priorityID>this._highestInputPriorityID||d.priorityID===this._highestInputPriorityID&&d.sprite.renderOrderID>this._highestRenderOrderID)&&(!c&&d.checkPointerOver(this)||c&&d.checkPointerDown(this))&&(this._highestRenderOrderID=d.sprite.renderOrderID,this._highestInputPriorityID=d.priorityID,this._highestRenderObject=d),d=d.next;while(null!=d)}return null===this._highestRenderObject?this.targetObject&&(this.targetObject._pointerOutHandler(this),this.targetObject=null):null===this.targetObject?(this.targetObject=this._highestRenderObject,this._highestRenderObject._pointerOverHandler(this)):this.targetObject===this._highestRenderObject?this._highestRenderObject.update(this)===!1&&(this.targetObject=null):(this.targetObject._pointerOutHandler(this),this.targetObject=this._highestRenderObject,this.targetObject._pointerOverHandler(this)),this -}},leave:function(a){this.withinGame=!1,this.move(a,!1)},stop:function(a){if(this._stateReset)return a.preventDefault(),void 0;if(this.timeUp=this.game.time.now,(this.game.input.multiInputOverride==b.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==b.Input.MOUSE_TOUCH_COMBINE||this.game.input.multiInputOverride==b.Input.TOUCH_OVERRIDES_MOUSE&&0===this.game.input.currentPointers)&&(this.game.input.onUp.dispatch(this,a),this.duration>=0&&this.duration<=this.game.input.tapRate&&(this.timeUp-this.previousTapTime0&&(this.active=!1),this.withinGame=!1,this.isDown=!1,this.isUp=!0,this.isMouse===!1&&this.game.input.currentPointers--,this.game.input.interactiveItems.total>0){var c=this.game.input.interactiveItems.next;do c&&c._releasedHandler(this),c=c.next;while(null!=c)}return this.targetObject&&this.targetObject._releasedHandler(this),this.targetObject=null,this},justPressed:function(a){return a=a||this.game.input.justPressedRate,this.isDown===!0&&this.timeDown+a>this.game.time.now},justReleased:function(a){return a=a||this.game.input.justReleasedRate,this.isUp===!0&&this.timeUp+a>this.game.time.now},reset:function(){this.isMouse===!1&&(this.active=!1),this.identifier=null,this.isDown=!1,this.isUp=!0,this.totalTouches=0,this._holdSent=!1,this._history.length=0,this._stateReset=!0,this.targetObject&&this.targetObject._releasedHandler(this),this.targetObject=null}},b.Pointer.prototype.constructor=b.Pointer,Object.defineProperty(b.Pointer.prototype,"duration",{get:function(){return this.isUp?-1:this.game.time.now-this.timeDown}}),Object.defineProperty(b.Pointer.prototype,"worldX",{get:function(){return this.game.world.camera.x+this.x}}),Object.defineProperty(b.Pointer.prototype,"worldY",{get:function(){return this.game.world.camera.y+this.y}}),b.Touch=function(a){this.game=a,this.disabled=!1,this.callbackContext=this.game,this.touchStartCallback=null,this.touchMoveCallback=null,this.touchEndCallback=null,this.touchEnterCallback=null,this.touchLeaveCallback=null,this.touchCancelCallback=null,this.preventDefault=!0,this.event=null,this._onTouchStart=null,this._onTouchMove=null,this._onTouchEnd=null,this._onTouchEnter=null,this._onTouchLeave=null,this._onTouchCancel=null,this._onTouchMove=null},b.Touch.prototype={start:function(){var a=this;this.game.device.touch&&(this._onTouchStart=function(b){return a.onTouchStart(b)},this._onTouchMove=function(b){return a.onTouchMove(b)},this._onTouchEnd=function(b){return a.onTouchEnd(b)},this._onTouchEnter=function(b){return a.onTouchEnter(b)},this._onTouchLeave=function(b){return a.onTouchLeave(b)},this._onTouchCancel=function(b){return a.onTouchCancel(b)},this.game.renderer.view.addEventListener("touchstart",this._onTouchStart,!1),this.game.renderer.view.addEventListener("touchmove",this._onTouchMove,!1),this.game.renderer.view.addEventListener("touchend",this._onTouchEnd,!1),this.game.renderer.view.addEventListener("touchenter",this._onTouchEnter,!1),this.game.renderer.view.addEventListener("touchleave",this._onTouchLeave,!1),this.game.renderer.view.addEventListener("touchcancel",this._onTouchCancel,!1))},consumeDocumentTouches:function(){this._documentTouchMove=function(a){a.preventDefault()},document.addEventListener("touchmove",this._documentTouchMove,!1)},onTouchStart:function(a){if(this.event=a,this.touchStartCallback&&this.touchStartCallback.call(this.callbackContext,a),!this.game.input.disabled&&!this.disabled){this.preventDefault&&a.preventDefault();for(var b=0;b0&&e>this.deadZone||0>e&&e<-this.deadZone?this.processAxisChange({axis:d,value:e}):this.processAxisChange({axis:d,value:0})}this._prevTimestamp=this._rawPad.timestamp}},connect:function(a){var b=!this._connected;this._index=a.index,this._connected=!0,this._rawPad=a,this._rawButtons=a.buttons,this._axes=a.axes,b&&this._padParent.onConnectCallback&&this._padParent.onConnectCallback.call(this._padParent.callbackContext,this._index),b&&this.onConnectCallback&&this.onConnectCallback.call(this.callbackContext)},disconnect:function(){var a=this._connected;this._connected=!1,this._rawPad=void 0,this._rawButtons=[],this._buttons=[];var b=this._index;this._index=null,a&&this._padParent.onDisconnectCallback&&this._padParent.onDisconnectCallback.call(this._padParent.callbackContext,b),a&&this.onDisconnectCallback&&this.onDisconnectCallback.call(this.callbackContext)},processAxisChange:function(a){this.game.input.disabled||this.game.input.gamepad.disabled||this._axes[a.axis]!==a.value&&(this._axes[a.axis]=a.value,this._padParent.onAxisCallback&&this._padParent.onAxisCallback.call(this._padParent.callbackContext,a,this._index),this.onAxisCallback&&this.onAxisCallback.call(this.callbackContext,a))},processButtonDown:function(a,b){this.game.input.disabled||this.game.input.gamepad.disabled||(this._padParent.onDownCallback&&this._padParent.onDownCallback.call(this._padParent.callbackContext,a,b,this._index),this.onDownCallback&&this.onDownCallback.call(this.callbackContext,a,b),this._buttons[a]&&this._buttons[a].isDown?this._buttons[a].duration=this.game.time.now-this._buttons[a].timeDown:this._buttons[a]?(this._buttons[a].isDown=!0,this._buttons[a].timeDown=this.game.time.now,this._buttons[a].duration=0,this._buttons[a].value=b):this._buttons[a]={isDown:!0,timeDown:this.game.time.now,timeUp:0,duration:0,value:b},this._hotkeys[a]&&this._hotkeys[a].processButtonDown(b))},processButtonUp:function(a,b){this.game.input.disabled||this.game.input.gamepad.disabled||(this._padParent.onUpCallback&&this._padParent.onUpCallback.call(this._padParent.callbackContext,a,b,this._index),this.onUpCallback&&this.onUpCallback.call(this.callbackContext,a,b),this._hotkeys[a]&&this._hotkeys[a].processButtonUp(b),this._buttons[a]?(this._buttons[a].isDown=!1,this._buttons[a].timeUp=this.game.time.now,this._buttons[a].value=b):this._buttons[a]={isDown:!1,timeDown:this.game.time.now,timeUp:this.game.time.now,duration:0,value:b})},processButtonFloat:function(a,b){this.game.input.disabled||this.game.input.gamepad.disabled||(this._padParent.onFloatCallback&&this._padParent.onFloatCallback.call(this._padParent.callbackContext,a,b,this._index),this.onFloatCallback&&this.onFloatCallback.call(this.callbackContext,a,b),this._buttons[a]?this._buttons[a].value=b:this._buttons[a]={value:b},this._hotkeys[a]&&this._hotkeys[a].processButtonFloat(b))},axis:function(a){return this._axes[a]?this._axes[a]:!1},isDown:function(a){return this._buttons[a]?this._buttons[a].isDown:!1},justReleased:function(a,b){return"undefined"==typeof b&&(b=250),this._buttons[a]&&this._buttons[a].isDown===!1&&this.game.time.now-this._buttons[a].timeUpd;d++)this._pointerData[d]={id:d,x:0,y:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1};this.snapOffset=new b.Point,this.enabled=!0,this.sprite.events&&null===this.sprite.events.onInputOver&&(this.sprite.events.onInputOver=new b.Signal,this.sprite.events.onInputOut=new b.Signal,this.sprite.events.onInputDown=new b.Signal,this.sprite.events.onInputUp=new b.Signal,this.sprite.events.onDragStart=new b.Signal,this.sprite.events.onDragStop=new b.Signal)}return this.sprite},reset:function(){this.enabled=!1;for(var a=0;10>a;a++)this._pointerData[a]={id:a,x:0,y:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1}},stop:function(){this.enabled!==!1&&(this.enabled=!1,this.game.input.interactiveItems.remove(this))},destroy:function(){this.enabled&&(this.enabled=!1,this.game.input.interactiveItems.remove(this),this._pointerData.length=0,this.boundsRect=null,this.boundsSprite=null,this.sprite=null)},pointerX:function(a){return a=a||0,this._pointerData[a].x},pointerY:function(a){return a=a||0,this._pointerData[a].y},pointerDown:function(a){return a=a||0,this._pointerData[a].isDown},pointerUp:function(a){return a=a||0,this._pointerData[a].isUp},pointerTimeDown:function(a){return a=a||0,this._pointerData[a].timeDown},pointerTimeUp:function(a){return a=a||0,this._pointerData[a].timeUp},pointerOver:function(a){if(this.enabled){if("undefined"!=typeof a)return this._pointerData[a].isOver;for(var b=0;10>b;b++)if(this._pointerData[b].isOver)return!0}return!1},pointerOut:function(a){if(this.enabled){if("undefined"!=typeof a)return this._pointerData[a].isOut;for(var b=0;10>b;b++)if(this._pointerData[b].isOut)return!0}return!1},pointerTimeOver:function(a){return a=a||0,this._pointerData[a].timeOver},pointerTimeOut:function(a){return a=a||0,this._pointerData[a].timeOut},pointerDragged:function(a){return a=a||0,this._pointerData[a].isDragged},checkPointerDown:function(a){return this.enabled===!1||this.sprite.visible===!1||this.sprite.parent.visible===!1?!1:this.game.input.hitTest(this.sprite,a,this._tempPoint)?this.pixelPerfectClick?this.checkPixel(this._tempPoint.x,this._tempPoint.y):!0:!1},checkPointerOver:function(a){return this.enabled===!1||this.sprite.visible===!1||this.sprite.parent.visible===!1?!1:this.game.input.hitTest(this.sprite,a,this._tempPoint)?this.pixelPerfectOver?this.checkPixel(this._tempPoint.x,this._tempPoint.y):!0:!1},checkPixel:function(a,b,c){if(this.sprite.texture.baseTexture.source){if(this.game.input.hitContext.clearRect(0,0,1,1),null===a&&null===b){this.game.input.getLocalPosition(this.sprite,c,this._tempPoint);var a=this._tempPoint.x,b=this._tempPoint.y}0!==this.sprite.anchor.x&&(a-=-this.sprite.texture.frame.width*this.sprite.anchor.x),0!==this.sprite.anchor.y&&(b-=-this.sprite.texture.frame.height*this.sprite.anchor.y),a+=this.sprite.texture.frame.x,b+=this.sprite.texture.frame.y,this.game.input.hitContext.drawImage(this.sprite.texture.baseTexture.source,a,b,1,1,0,0,1,1);var d=this.game.input.hitContext.getImageData(0,0,1,1);if(d.data[3]>=this.pixelPerfectAlpha)return!0}return!1},update:function(a){return null!==this.sprite?this.enabled===!1||this.sprite.visible===!1||this.sprite.group&&this.sprite.group.visible===!1?(this._pointerOutHandler(a),!1):this.draggable&&this._draggedPointerID==a.id?this.updateDrag(a):this._pointerData[a.id].isOver===!0?this.checkPointerOver(a)?(this._pointerData[a.id].x=a.x-this.sprite.x,this._pointerData[a.id].y=a.y-this.sprite.y,!0):(this._pointerOutHandler(a),!1):void 0:void 0},_pointerOverHandler:function(a){null!==this.sprite&&this._pointerData[a.id].isOver===!1&&(this._pointerData[a.id].isOver=!0,this._pointerData[a.id].isOut=!1,this._pointerData[a.id].timeOver=this.game.time.now,this._pointerData[a.id].x=a.x-this.sprite.x,this._pointerData[a.id].y=a.y-this.sprite.y,this.useHandCursor&&this._pointerData[a.id].isDragged===!1&&(this.game.canvas.style.cursor="pointer"),this.sprite.events.onInputOver.dispatch(this.sprite,a))},_pointerOutHandler:function(a){null!==this.sprite&&(this._pointerData[a.id].isOver=!1,this._pointerData[a.id].isOut=!0,this._pointerData[a.id].timeOut=this.game.time.now,this.useHandCursor&&this._pointerData[a.id].isDragged===!1&&(this.game.canvas.style.cursor="default"),this.sprite&&this.sprite.events&&this.sprite.events.onInputOut.dispatch(this.sprite,a))},_touchedHandler:function(a){if(null!==this.sprite){if(this._pointerData[a.id].isDown===!1&&this._pointerData[a.id].isOver===!0){if(this.pixelPerfectClick&&!this.checkPixel(null,null,a))return;this._pointerData[a.id].isDown=!0,this._pointerData[a.id].isUp=!1,this._pointerData[a.id].timeDown=this.game.time.now,this.sprite.events.onInputDown.dispatch(this.sprite,a),this.draggable&&this.isDragged===!1&&this.startDrag(a),this.bringToTop&&this.sprite.bringToTop()}return this.consumePointerEvent}},_releasedHandler:function(a){null!==this.sprite&&this._pointerData[a.id].isDown&&a.isUp&&(this._pointerData[a.id].isDown=!1,this._pointerData[a.id].isUp=!0,this._pointerData[a.id].timeUp=this.game.time.now,this._pointerData[a.id].downDuration=this._pointerData[a.id].timeUp-this._pointerData[a.id].timeDown,this.checkPointerOver(a)?this.sprite.events.onInputUp.dispatch(this.sprite,a,!0):(this.sprite.events.onInputUp.dispatch(this.sprite,a,!1),this.useHandCursor&&(this.game.canvas.style.cursor="default")),this.draggable&&this.isDragged&&this._draggedPointerID==a.id&&this.stopDrag(a))},updateDrag:function(a){return a.isUp?(this.stopDrag(a),!1):(this.sprite.fixedToCamera?(this.allowHorizontalDrag&&(this.sprite.cameraOffset.x=a.x+this._dragPoint.x+this.dragOffset.x),this.allowVerticalDrag&&(this.sprite.cameraOffset.y=a.y+this._dragPoint.y+this.dragOffset.y),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(this.sprite.cameraOffset.x=Math.round((this.sprite.cameraOffset.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.cameraOffset.y=Math.round((this.sprite.cameraOffset.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY)):(this.allowHorizontalDrag&&(this.sprite.x=a.x+this._dragPoint.x+this.dragOffset.x),this.allowVerticalDrag&&(this.sprite.y=a.y+this._dragPoint.y+this.dragOffset.y),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(this.sprite.x=Math.round((this.sprite.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.y=Math.round((this.sprite.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY)),!0)},justOver:function(a,b){return a=a||0,b=b||500,this._pointerData[a].isOver&&this.overDuration(a)a;a++)this._pointerData[a].isDragged=!1;this.draggable=!1,this.isDragged=!1,this._draggedPointerID=-1},startDrag:function(a){this.isDragged=!0,this._draggedPointerID=a.id,this._pointerData[a.id].isDragged=!0,this.sprite.fixedToCamera?this.dragFromCenter?(this.sprite.centerOn(a.x,a.y),this._dragPoint.setTo(this.sprite.cameraOffset.x-a.x,this.sprite.cameraOffset.y-a.y)):this._dragPoint.setTo(this.sprite.cameraOffset.x-a.x,this.sprite.cameraOffset.y-a.y):this.dragFromCenter?(this.sprite.centerOn(a.x,a.y),this._dragPoint.setTo(this.sprite.x-a.x,this.sprite.y-a.y)):this._dragPoint.setTo(this.sprite.x-a.x,this.sprite.y-a.y),this.updateDrag(a),this.bringToTop&&this.sprite.bringToTop(),this.sprite.events.onDragStart.dispatch(this.sprite,a)},stopDrag:function(a){this.isDragged=!1,this._draggedPointerID=-1,this._pointerData[a.id].isDragged=!1,this.snapOnRelease&&(this.sprite.fixedToCamera?(this.sprite.cameraOffset.x=Math.round((this.sprite.cameraOffset.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.cameraOffset.y=Math.round((this.sprite.cameraOffset.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY):(this.sprite.x=Math.round((this.sprite.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.y=Math.round((this.sprite.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY)),this.sprite.events.onDragStop.dispatch(this.sprite,a),this.sprite.events.onInputUp.dispatch(this.sprite,a),this.checkPointerOver(a)===!1&&this._pointerOutHandler(a)},setDragLock:function(a,b){"undefined"==typeof a&&(a=!0),"undefined"==typeof b&&(b=!0),this.allowHorizontalDrag=a,this.allowVerticalDrag=b},enableSnap:function(a,b,c,d){"undefined"==typeof c&&(c=!0),"undefined"==typeof d&&(d=!1),"undefined"==typeof snapOffsetX&&(snapOffsetX=0),"undefined"==typeof snapOffsetY&&(snapOffsetY=0),this.snapX=a,this.snapY=b,this.snapOffsetX=snapOffsetX,this.snapOffsetY=snapOffsetY,this.snapOnDrag=c,this.snapOnRelease=d},disableSnap:function(){this.snapOnDrag=!1,this.snapOnRelease=!1},checkBoundsRect:function(){this.sprite.fixedToCamera?(this.sprite.cameraOffset.xthis.boundsRect.right&&(this.sprite.cameraOffset.x=this.boundsRect.right-this.sprite.width),this.sprite.cameraOffset.ythis.boundsRect.bottom&&(this.sprite.cameraOffset.y=this.boundsRect.bottom-this.sprite.height)):(this.sprite.xthis.boundsRect.right&&(this.sprite.x=this.boundsRect.right-this.sprite.width),this.sprite.ythis.boundsRect.bottom&&(this.sprite.y=this.boundsRect.bottom-this.sprite.height))},checkBoundsSprite:function(){this.sprite.fixedToCamera&&this.boundsSprite.fixedToCamera?(this.sprite.cameraOffset.xthis.boundsSprite.camerOffset.x+this.boundsSprite.width&&(this.sprite.cameraOffset.x=this.boundsSprite.camerOffset.x+this.boundsSprite.width-this.sprite.width),this.sprite.cameraOffset.ythis.boundsSprite.camerOffset.y+this.boundsSprite.height&&(this.sprite.cameraOffset.y=this.boundsSprite.camerOffset.y+this.boundsSprite.height-this.sprite.height)):(this.sprite.xthis.boundsSprite.x+this.boundsSprite.width&&(this.sprite.x=this.boundsSprite.x+this.boundsSprite.width-this.sprite.width),this.sprite.ythis.boundsSprite.y+this.boundsSprite.height&&(this.sprite.y=this.boundsSprite.y+this.boundsSprite.height-this.sprite.height))}},b.InputHandler.prototype.constructor=b.InputHandler,b.Events=function(a){this.parent=a,this.onAddedToGroup=new b.Signal,this.onRemovedFromGroup=new b.Signal,this.onKilled=new b.Signal,this.onRevived=new b.Signal,this.onOutOfBounds=new b.Signal,this.onInputOver=null,this.onInputOut=null,this.onInputDown=null,this.onInputUp=null,this.onDragStart=null,this.onDragStop=null,this.onAnimationStart=null,this.onAnimationComplete=null,this.onAnimationLoop=null},b.Events.prototype={destroy:function(){this.parent=null,this.onAddedToGroup.dispose(),this.onRemovedFromGroup.dispose(),this.onKilled.dispose(),this.onRevived.dispose(),this.onOutOfBounds.dispose(),this.onInputOver&&(this.onInputOver.dispose(),this.onInputOut.dispose(),this.onInputDown.dispose(),this.onInputUp.dispose(),this.onDragStart.dispose(),this.onDragStop.dispose()),this.onAnimationStart&&(this.onAnimationStart.dispose(),this.onAnimationComplete.dispose(),this.onAnimationLoop.dispose())}},b.Events.prototype.constructor=b.Events,b.GameObjectFactory=function(a){this.game=a,this.world=this.game.world},b.GameObjectFactory.prototype={existing:function(a){return this.world.add(a)},image:function(a,c,d,e,f){return"undefined"==typeof f&&(f=this.world),f.add(new b.Image(this.game,a,c,d,e))},sprite:function(a,b,c,d,e){return"undefined"==typeof e&&(e=this.world),e.create(a,b,c,d)},tween:function(a){return this.game.tweens.create(a)},group:function(a,c,d){return"undefined"==typeof c&&(c="group"),"undefined"==typeof d&&(d=!1),new b.Group(this.game,a,c,d)},spriteBatch:function(a,c,d){return"undefined"==typeof c&&(c="group"),"undefined"==typeof d&&(d=!1),new b.SpriteBatch(this.game,a,c,d)},audio:function(a,b,c,d){return this.game.sound.add(a,b,c,d)},sound:function(a,b,c,d){return this.game.sound.add(a,b,c,d)},tileSprite:function(a,c,d,e,f,g,h){return"undefined"==typeof h&&(h=this.world),h.add(new b.TileSprite(this.game,a,c,d,e,f,g))},text:function(a,c,d,e,f){return"undefined"==typeof f&&(f=this.world),f.add(new b.Text(this.game,a,c,d,e))},button:function(a,c,d,e,f,g,h,i,j,k){return"undefined"==typeof k&&(k=this.world),k.add(new b.Button(this.game,a,c,d,e,f,g,h,i,j))},graphics:function(a,c,d){return"undefined"==typeof d&&(d=this.world),d.add(new b.Graphics(this.game,a,c)) -},emitter:function(a,c,d){return this.game.particles.add(new b.Particles.Arcade.Emitter(this.game,a,c,d))},bitmapFont:function(a,c,d,e,f,g,h,i,j){return new b.BitmapFont(this.game,a,c,d,e,f,g,h,i,j)},bitmapText:function(a,c,d,e,f,g){return"undefined"==typeof g&&(g=this.world),g.add(new b.BitmapText(this.game,a,c,d,e,f))},tilemap:function(a,c){return new b.Tilemap(this.game,a,c)},renderTexture:function(a,c,d,e){("undefined"==typeof d||""===d)&&(d=this.game.rnd.uuid()),"undefined"==typeof e&&(e=!1);var f=new b.RenderTexture(this.game,a,c,d);return e&&this.game.cache.addRenderTexture(d,f),f},bitmapData:function(a,c,d){"undefined"==typeof d&&(d=!1),("undefined"==typeof key||""===key)&&(key=this.game.rnd.uuid());var e=new b.BitmapData(this.game,key,a,c);return d&&this.game.cache.addBitmapData(key,e),e},filter:function(a){var c=Array.prototype.splice.call(arguments,1),a=new b.Filter[a](this.game);return a.init.apply(a,c),a}},b.GameObjectFactory.prototype.constructor=b.GameObjectFactory,b.BitmapData=function(c,d,e,f){"undefined"==typeof e&&(e=100),"undefined"==typeof f&&(f=100),this.game=c,this.key=d,this.width=e,this.height=f,this.canvas=b.Canvas.create(e,f),this.context=this.canvas.getContext("2d"),this.ctx=this.context,this.imageData=this.context.getImageData(0,0,e,f),this.pixels=this.imageData.data.buffer?this.imageData.data.buffer:this.imageData.data,this.baseTexture=new a.BaseTexture(this.canvas),this.texture=new a.Texture(this.baseTexture),this.textureFrame=new b.Frame(0,0,0,e,f,"bitmapData",c.rnd.uuid()),this.type=b.BITMAPDATA,this._dirty=!1},b.BitmapData.prototype={add:function(a){if(Array.isArray(a))for(var b=0;b=0&&a<=this.width&&b>=0&&b<=this.height&&(this.pixels[b*this.width+a]=f<<24|e<<16|d<<8|c,this.context.putImageData(this.imageData,0,0),this._dirty=!0)},setPixel:function(a,b,c,d,e){this.setPixel32(a,b,c,d,e,255)},getPixel:function(a,b){return a>=0&&a<=this.width&&b>=0&&b<=this.height?this.data32[b*this.width+a]:void 0},getPixel32:function(a,b){return a>=0&&a<=this.width&&b>=0&&b<=this.height?this.data32[b*this.width+a]:void 0},getPixels:function(a){return this.context.getImageData(a.x,a.y,a.width,a.height)},copyPixels:function(a,b,c,d){this.context.drawImage(a,b.x,b.y,b.width,b.height,c,d,b.width,b.height)},render:function(){this._dirty&&(this.game.renderType==b.WEBGL&&a.texturesToUpdate.push(this.baseTexture),this._dirty=!1)}},b.BitmapData.prototype.constructor=b.BitmapData,b.Sprite=function(c,d,e,f,g){d=d||0,e=e||0,f=f||null,g=g||null,this.game=c,this.name="",this.type=b.SPRITE,this.events=new b.Events(this),this.animations=new b.AnimationManager(this),this.key=f,this._frame=0,this._frameName="",a.Sprite.call(this,a.TextureCache.__default),this.loadTexture(f,g),this.position.set(d,e),this.world=new b.Point(d,e),this.autoCull=!1,this.input=null,this.body=null,this.health=1,this.lifespan=0,this.checkWorldBounds=!1,this.outOfBoundsKill=!1,this.debug=!1,this.cameraOffset=new b.Point,this._cache=new Int16Array([0,0,0,0,1,0,1,0]),this._bounds=new b.Rectangle},b.Sprite.prototype=Object.create(a.Sprite.prototype),b.Sprite.prototype.constructor=b.Sprite,b.Sprite.prototype.preUpdate=function(){if(1===this._cache[4])return this.world.setTo(this.parent.position.x+this.position.x,this.parent.position.y+this.position.y),this.worldTransform.tx=this.world.x,this.worldTransform.ty=this.world.y,this._cache[0]=this.world.x,this._cache[1]=this.world.y,this._cache[2]=this.rotation,this._cache[4]=0,!1;if(this._cache[0]=this.world.x,this._cache[1]=this.world.y,this._cache[2]=this.rotation,!this.exists||!this.parent.exists)return this._cache[3]=-1,!1;if(this.lifespan>0&&(this.lifespan-=this.game.time.elapsed,this.lifespan<=0))return this.kill(),!1;if((this.autoCull||this.checkWorldBounds)&&this._bounds.copyFrom(this.getBounds()),this.autoCull&&(this.renderable=this.game.world.camera.screenView.intersects(this._bounds)),this.checkWorldBounds)if(1===this._cache[5]&&this.game.world.bounds.intersects(this._bounds))this._cache[5]=0;else if(0===this._cache[5]&&!this.game.world.bounds.intersects(this._bounds)&&(this._cache[5]=1,this.events.onOutOfBounds.dispatch(this),this.outOfBoundsKill))return this.kill(),!1;return this.world.setTo(this.game.camera.x+this.worldTransform.tx,this.game.camera.y+this.worldTransform.ty),this.visible&&(this._cache[3]=this.game.world.currentRenderOrderID++),this.animations.update(),this.body,!0},b.Sprite.prototype.update=function(){},b.Sprite.prototype.postUpdate=function(){this.key instanceof b.BitmapData&&this.key._dirty&&this.key.render(),this.exists&&this.body&&this.body.postUpdate(),1===this._cache[7]&&(this.position.x=this.game.camera.view.x+this.cameraOffset.x,this.position.y=this.game.camera.view.y+this.cameraOffset.y)},b.Sprite.prototype.loadTexture=function(c,d){return d=d||0,c instanceof b.RenderTexture?(this.key=c.key,this.setTexture(c),void 0):c instanceof b.BitmapData?(this.key=c.key,this.setTexture(c.texture),void 0):c instanceof a.Texture?(this.key=c,this.setTexture(c),void 0):null===c||"undefined"==typeof c?(this.key="__default",this.setTexture(a.TextureCache[this.key]),void 0):"string"!=typeof c||this.game.cache.checkImageKey(c)?this.game.cache.isSpriteSheet(c)?(this.key=c,this.animations.loadFrameData(this.game.cache.getFrameData(c)),"string"==typeof d?this.frameName=d:this.frame=d,void 0):(this.key=c,this.setTexture(a.TextureCache[c]),void 0):(this.key="__missing",this.setTexture(a.TextureCache[this.key]),void 0)},b.Sprite.prototype.crop=function(c){if("undefined"==typeof c||null===c)this.texture.hasOwnProperty("sourceWidth")&&this.texture.setFrame(new b.Rectangle(0,0,this.texture.sourceWidth,this.texture.sourceHeight));else if(this.texture instanceof a.Texture){var d={};b.Utils.extend(!0,d,this.texture),d.sourceWidth=d.width,d.sourceHeight=d.height,d.frame=c,d.width=c.width,d.height=c.height,this.texture=d,this.texture.updateFrame=!0,a.Texture.frameUpdates.push(this.texture)}else this.texture.setFrame(c)},b.Sprite.prototype.revive=function(a){return"undefined"==typeof a&&(a=1),this.alive=!0,this.exists=!0,this.visible=!0,this.health=a,this.events&&this.events.onRevived.dispatch(this),this},b.Sprite.prototype.kill=function(){return this.alive=!1,this.exists=!1,this.visible=!1,this.events&&this.events.onKilled.dispatch(this),this},b.Sprite.prototype.destroy=function(){this.filters&&(this.filters=null),this.parent&&this.parent.remove(this),this.input&&this.input.destroy(),this.animations&&this.animations.destroy(),this.body&&this.body.destroy(),this.events&&this.events.destroy(),this.alive=!1,this.exists=!1,this.visible=!1,this.game=null},b.Sprite.prototype.damage=function(a){return this.alive&&(this.health-=a,this.health<0&&this.kill()),this},b.Sprite.prototype.reset=function(a,b,c){return"undefined"==typeof c&&(c=1),this.world.setTo(a,b),this.position.x=a,this.position.y=b,this.alive=!0,this.exists=!0,this.visible=!0,this.renderable=!0,this._outOfBoundsFired=!1,this.health=c,this.body&&this.body.reset(a,b,!1,!1),this},b.Sprite.prototype.bringToTop=function(a){return"undefined"==typeof a&&this.parent&&this.parent.bringToTop(this),this},b.Sprite.prototype.play=function(a,b,c,d){return this.animations?this.animations.play(a,b,c,d):void 0},Object.defineProperty(b.Sprite.prototype,"angle",{get:function(){return b.Math.wrapAngle(b.Math.radToDeg(this.rotation))},set:function(a){this.rotation=b.Math.degToRad(b.Math.wrapAngle(a))}}),Object.defineProperty(b.Sprite.prototype,"deltaX",{get:function(){return this.world.x-this._cache[0]}}),Object.defineProperty(b.Sprite.prototype,"deltaY",{get:function(){return this.world.y-this._cache[1]}}),Object.defineProperty(b.Sprite.prototype,"deltaZ",{get:function(){return this.rotation-this._cache[2]}}),Object.defineProperty(b.Sprite.prototype,"inWorld",{get:function(){return this.game.world.bounds.intersects(this.getBounds())}}),Object.defineProperty(b.Sprite.prototype,"inCamera",{get:function(){return this.game.world.camera.screenView.intersects(this.getBounds())}}),Object.defineProperty(b.Sprite.prototype,"frame",{get:function(){return this.animations.frame},set:function(a){this.animations.frame=a}}),Object.defineProperty(b.Sprite.prototype,"frameName",{get:function(){return this.animations.frameName},set:function(a){this.animations.frameName=a}}),Object.defineProperty(b.Sprite.prototype,"renderOrderID",{get:function(){return this._cache[3]}}),Object.defineProperty(b.Sprite.prototype,"inputEnabled",{get:function(){return this.input&&this.input.enabled},set:function(a){a?null===this.input&&(this.input=new b.InputHandler(this),this.input.start()):this.input&&this.input.enabled&&this.input.stop()}}),Object.defineProperty(b.Sprite.prototype,"physicsEnabled",{get:function(){return null!==this.body},set:function(a){a?null===this.body&&(this.body=new b.Physics.Body(this),this.anchor.set(.5)):this.body&&this.body.destroy()}}),Object.defineProperty(b.Sprite.prototype,"exists",{get:function(){return!!this._cache[6]},set:function(a){a?(this._cache[6]=1,this.body&&this.body.addToWorld(),this.visible=!0):(this._cache[6]=0,this.body&&this.body.removeFromWorld(),this.visible=!1)}}),Object.defineProperty(b.Sprite.prototype,"fixedToCamera",{get:function(){return!!this._cache[7]},set:function(a){a?(this._cache[7]=1,this.cameraOffset.set(this.x,this.y)):this._cache[7]=0}}),b.Image=function(c,d,e,f,g){d=d||0,e=e||0,f=f||null,g=g||null,this.game=c,this.exists=!0,this.name="",this.type=b.IMAGE,this.events=new b.Events(this),this.key=f,this._frame=0,this._frameName="",a.Sprite.call(this,a.TextureCache.__default),this.loadTexture(f,g),this.position.set(d,e),this.world=new b.Point(d,e),this.autoCull=!1,this.input=null,this.cameraOffset=new b.Point,this._cache=new Int16Array([0,0,0,0,1,0,1,0])},b.Image.prototype=Object.create(a.Sprite.prototype),b.Image.prototype.constructor=b.Image,b.Image.prototype.preUpdate=function(){return this._cache[0]=this.world.x,this._cache[1]=this.world.y,this._cache[2]=this.rotation,this.exists&&this.parent.exists?(this.autoCull&&(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]),this.visible&&(this._cache[3]=this.game.world.currentRenderOrderID++),!0):(this.renderOrderID=-1,!1)},b.Image.prototype.update=function(){},b.Image.prototype.postUpdate=function(){this.key instanceof b.BitmapData&&this.key._dirty&&this.key.render(),1===this._cache[7]&&(this.position.x=this.game.camera.view.x+this.cameraOffset.x,this.position.y=this.game.camera.view.y+this.cameraOffset.y)},b.Image.prototype.loadTexture=function(c,d){if(d=d||0,c instanceof b.RenderTexture)return this.key=c.key,this.setTexture(c),void 0;if(c instanceof b.BitmapData)return this.key=c.key,this.setTexture(c.texture),void 0;if(c instanceof a.Texture)return this.key=c,this.setTexture(c),void 0;if(null===c||"undefined"==typeof c)return this.key="__default",this.setTexture(a.TextureCache[this.key]),void 0;if("string"==typeof c&&!this.game.cache.checkImageKey(c))return this.key="__missing",this.setTexture(a.TextureCache[this.key]),void 0;if(this.game.cache.isSpriteSheet(c)){this.key=c;var e=this.game.cache.getFrameData(c);return"string"==typeof d?(this._frame=0,this._frameName=d,this.setTexture(a.TextureCache[e.getFrameByName(d).uuid]),void 0):(this._frame=d,this._frameName="",this.setTexture(a.TextureCache[e.getFrame(d).uuid]),void 0)}return this.key=c,this.setTexture(a.TextureCache[c]),void 0},b.Image.prototype.crop=function(c){if("undefined"==typeof c||null===c)this.texture.hasOwnProperty("sourceWidth")&&this.texture.setFrame(new b.Rectangle(0,0,this.texture.sourceWidth,this.texture.sourceHeight));else if(this.texture instanceof a.Texture){var d={};b.Utils.extend(!0,d,this.texture),d.sourceWidth=d.width,d.sourceHeight=d.height,d.frame=c,d.width=c.width,d.height=c.height,this.texture=d,this.texture.updateFrame=!0,a.Texture.frameUpdates.push(this.texture)}else this.texture.setFrame(c)},b.Image.prototype.revive=function(){return this.alive=!0,this.exists=!0,this.visible=!0,this.events&&this.events.onRevived.dispatch(this),this},b.Image.prototype.kill=function(){return this.alive=!1,this.exists=!1,this.visible=!1,this.events&&this.events.onKilled.dispatch(this),this},b.Image.prototype.destroy=function(){this.filters&&(this.filters=null),this.parent&&this.parent.remove(this),this.events&&this.events.destroy(),this.input&&this.input.destroy(),this.alive=!1,this.exists=!1,this.visible=!1,this.game=null},b.Image.prototype.reset=function(a,b){return this.world.setTo(a,b),this.position.x=a,this.position.y=b,this.alive=!0,this.exists=!0,this.visible=!0,this.renderable=!0,this},b.Image.prototype.bringToTop=function(a){return"undefined"==typeof a&&this.parent&&this.parent.bringToTop(this),this},Object.defineProperty(b.Image.prototype,"angle",{get:function(){return b.Math.wrapAngle(b.Math.radToDeg(this.rotation))},set:function(a){this.rotation=b.Math.degToRad(b.Math.wrapAngle(a))}}),Object.defineProperty(b.Image.prototype,"deltaX",{get:function(){return this.world.x-this._cache[0]}}),Object.defineProperty(b.Image.prototype,"deltaY",{get:function(){return this.world.y-this._cache[1]}}),Object.defineProperty(b.Image.prototype,"deltaZ",{get:function(){return this.rotation-this._cache[2]}}),Object.defineProperty(b.Image.prototype,"inWorld",{get:function(){return this.game.world.bounds.intersects(this.getBounds())}}),Object.defineProperty(b.Image.prototype,"inCamera",{get:function(){return this.game.world.camera.screenView.intersects(this.getBounds())}}),Object.defineProperty(b.Image.prototype,"frame",{get:function(){return this._frame},set:function(b){if(b!==this.frame&&this.game.cache.isSpriteSheet(this.key)){var c=this.game.cache.getFrameData(this.key);c&&be?(g>0&&(b+="\n"),b+=f[g]+" ",e=this.style.wordWrapWidth-h):(e-=i,b+=f[g]+" ")}d0)do this.removeChild(this.children[0]);while(this.children.length>0)},Object.defineProperty(b.BitmapText.prototype,"align",{get:function(){return this._align},set:function(a){a!==this._align&&(this._align=a,this.setStyle())}}),Object.defineProperty(b.BitmapText.prototype,"tint",{get:function(){return this._tint},set:function(a){a!==this._tint&&(this._tint=a,this.dirty=!0)}}),Object.defineProperty(b.BitmapText.prototype,"angle",{get:function(){return b.Math.radToDeg(this.rotation)},set:function(a){this.rotation=b.Math.degToRad(a)}}),Object.defineProperty(b.BitmapText.prototype,"font",{get:function(){return this._font},set:function(a){a!==this._font&&(this._font=a.trim(),this.style.font=this._fontSize+"px '"+this._font+"'",this.dirty=!0)}}),Object.defineProperty(b.BitmapText.prototype,"fontSize",{get:function(){return this._fontSize},set:function(a){a=parseInt(a),a!==this._fontSize&&(this._fontSize=a,this.style.font=this._fontSize+"px '"+this._font+"'",this.dirty=!0)}}),Object.defineProperty(b.BitmapText.prototype,"text",{get:function(){return this._text},set:function(a){a!==this._text&&(this._text=a.toString()||" ",this.dirty=!0)}}),Object.defineProperty(b.BitmapText.prototype,"inputEnabled",{get:function(){return this.input&&this.input.enabled},set:function(a){a?null===this.input&&(this.input=new b.InputHandler(this),this.input.start()):this.input&&this.input.enabled&&this.input.stop()}}),Object.defineProperty(b.BitmapText.prototype,"fixedToCamera",{get:function(){return!!this._cache[7]},set:function(a){a?(this._cache[7]=1,this.cameraOffset.set(this.x,this.y)):this._cache[7]=0}}),b.Button=function(a,c,d,e,f,g,h,i,j,k){c=c||0,d=d||0,e=e||null,f=f||null,g=g||this,b.Image.call(this,a,c,d,e,i),this.type=b.BUTTON,this._onOverFrameName=null,this._onOutFrameName=null,this._onDownFrameName=null,this._onUpFrameName=null,this._onOverFrameID=null,this._onOutFrameID=null,this._onDownFrameID=null,this._onUpFrameID=null,this.onOverSound=null,this.onOutSound=null,this.onDownSound=null,this.onUpSound=null,this.onOverSoundMarker="",this.onOutSoundMarker="",this.onDownSoundMarker="",this.onUpSoundMarker="",this.onInputOver=new b.Signal,this.onInputOut=new b.Signal,this.onInputDown=new b.Signal,this.onInputUp=new b.Signal,this.freezeFrames=!1,this.forceOut=!1,this.inputEnabled=!0,this.input.start(0,!0),this.setFrames(h,i,j,k),null!==f&&this.onInputUp.add(f,g),this.events.onInputOver.add(this.onInputOverHandler,this),this.events.onInputOut.add(this.onInputOutHandler,this),this.events.onInputDown.add(this.onInputDownHandler,this),this.events.onInputUp.add(this.onInputUpHandler,this)},b.Button.prototype=Object.create(b.Image.prototype),b.Button.prototype.constructor=b.Button,b.Button.prototype.clearFrames=function(){this._onOverFrameName=null,this._onOverFrameID=null,this._onOutFrameName=null,this._onOutFrameID=null,this._onDownFrameName=null,this._onDownFrameID=null,this._onUpFrameName=null,this._onUpFrameID=null},b.Button.prototype.setFrames=function(a,b,c,d){this.clearFrames(),null!==a&&("string"==typeof a?(this._onOverFrameName=a,this.input.pointerOver()&&(this.frameName=a)):(this._onOverFrameID=a,this.input.pointerOver()&&(this.frame=a))),null!==b&&("string"==typeof b?(this._onOutFrameName=b,this.input.pointerOver()===!1&&(this.frameName=b)):(this._onOutFrameID=b,this.input.pointerOver()===!1&&(this.frame=b))),null!==c&&("string"==typeof c?(this._onDownFrameName=c,this.input.pointerDown()&&(this.frameName=c)):(this._onDownFrameID=c,this.input.pointerDown()&&(this.frame=c))),null!==d&&("string"==typeof d?(this._onUpFrameName=d,this.input.pointerUp()&&(this.frameName=d)):(this._onUpFrameID=d,this.input.pointerUp()&&(this.frame=d)))},b.Button.prototype.setSounds=function(a,b,c,d,e,f,g,h){this.setOverSound(a,b),this.setOutSound(e,f),this.setDownSound(c,d),this.setUpSound(g,h)},b.Button.prototype.setOverSound=function(a,c){this.onOverSound=null,this.onOverSoundMarker="",a instanceof b.Sound&&(this.onOverSound=a),"string"==typeof c&&(this.onOverSoundMarker=c)},b.Button.prototype.setOutSound=function(a,c){this.onOutSound=null,this.onOutSoundMarker="",a instanceof b.Sound&&(this.onOutSound=a),"string"==typeof c&&(this.onOutSoundMarker=c)},b.Button.prototype.setDownSound=function(a,c){this.onDownSound=null,this.onDownSoundMarker="",a instanceof b.Sound&&(this.onDownSound=a),"string"==typeof c&&(this.onDownSoundMarker=c)},b.Button.prototype.setUpSound=function(a,c){this.onUpSound=null,this.onUpSoundMarker="",a instanceof b.Sound&&(this.onUpSound=a),"string"==typeof c&&(this.onUpSoundMarker=c)},b.Button.prototype.onInputOverHandler=function(a,b){this.freezeFrames===!1&&this.setState(1),this.onOverSound&&this.onOverSound.play(this.onOverSoundMarker),this.onInputOver&&this.onInputOver.dispatch(this,b) -},b.Button.prototype.onInputOutHandler=function(a,b){this.freezeFrames===!1&&this.setState(2),this.onOutSound&&this.onOutSound.play(this.onOutSoundMarker),this.onInputOut&&this.onInputOut.dispatch(this,b)},b.Button.prototype.onInputDownHandler=function(a,b){this.freezeFrames===!1&&this.setState(3),this.onDownSound&&this.onDownSound.play(this.onDownSoundMarker),this.onInputDown&&this.onInputDown.dispatch(this,b)},b.Button.prototype.onInputUpHandler=function(a,b,c){this.onUpSound&&this.onUpSound.play(this.onUpSoundMarker),this.onInputUp&&this.onInputUp.dispatch(this,b,c),this.freezeFrames||(this.forceOut?this.setState(2):this._onUpFrameName||this._onUpFrameID?this.setState(4):c?this.setState(1):this.setState(2))},b.Button.prototype.setState=function(a){1===a?null!=this._onOverFrameName?this.frameName=this._onOverFrameName:null!=this._onOverFrameID&&(this.frame=this._onOverFrameID):2===a?null!=this._onOutFrameName?this.frameName=this._onOutFrameName:null!=this._onOutFrameID&&(this.frame=this._onOutFrameID):3===a?null!=this._onDownFrameName?this.frameName=this._onDownFrameName:null!=this._onDownFrameID&&(this.frame=this._onDownFrameID):4===a&&(null!=this._onUpFrameName?this.frameName=this._onUpFrameName:null!=this._onUpFrameID&&(this.frame=this._onUpFrameID))},b.Graphics=function(c,d,e){d=d||0,e=e||0,this.game=c,this.exists=!0,this.name="",this.type=b.GRAPHICS,this.world=new b.Point(d,e),this.events=new b.Events(this),this.input=null,this.cameraOffset=new b.Point,a.Graphics.call(this),this.position.set(d,e),this._cache=new Int16Array([0,0,0,0,1,0,1,0])},b.Graphics.prototype=Object.create(a.Graphics.prototype),b.Graphics.prototype.constructor=b.Graphics,b.Graphics.prototype.preUpdate=function(){return this._cache[0]=this.world.x,this._cache[1]=this.world.y,this._cache[2]=this.rotation,this.exists&&this.parent.exists?(this.autoCull&&(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]),this.visible&&(this._cache[3]=this.game.world.currentRenderOrderID++),!0):(this.renderOrderID=-1,!1)},b.Graphics.prototype.update=function(){},b.Graphics.prototype.postUpdate=function(){1===this._cache[7]&&(this.position.x=this.game.camera.view.x+this.cameraOffset.x,this.position.y=this.game.camera.view.y+this.cameraOffset.y)},b.Graphics.prototype.destroy=function(){this.clear(),this.parent&&this.parent.remove(this),this.exists=!1,this.visible=!1,this.game=null},b.Graphics.prototype.drawPolygon=function(a){this.moveTo(a.points[0].x,a.points[0].y);for(var b=1;b?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",b.BitmapFont.TEXT_SET2=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",b.BitmapFont.TEXT_SET3="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",b.BitmapFont.TEXT_SET4="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",b.BitmapFont.TEXT_SET5="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",b.BitmapFont.TEXT_SET6="ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",b.BitmapFont.TEXT_SET7="AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",b.BitmapFont.TEXT_SET8="0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",b.BitmapFont.TEXT_SET9="ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",b.BitmapFont.TEXT_SET10="ABCDEFGHIJKLMNOPQRSTUVWXYZ",b.BitmapFont.TEXT_SET11="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789",b.BitmapFont.prototype.setFixedWidth=function(a,b){"undefined"==typeof b&&(b="left"),this.fixedWidth=a,this.align=b},b.BitmapFont.prototype.setText=function(a,b,c,d,e,f){this.multiLine=b||!1,this.customSpacingX=c||0,this.customSpacingY=d||0,this.align=e||"left",this.autoUpperCase=f?!1:!0,a.length>0&&(this.text=a)},b.BitmapFont.prototype.resize=function(b,c){if(this.width=b,this.height=c,this.frame.width=this.width,this.frame.height=this.height,this.baseTexture.width=this.width,this.baseTexture.height=this.height,this.renderer.type===a.WEBGL_RENDERER){this.projection.x=this.width/2,this.projection.y=-this.height/2;var d=this.renderer.gl;d.bindTexture(d.TEXTURE_2D,this.baseTexture._glTextures[d.id]),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,this.width,this.height,0,d.RGBA,d.UNSIGNED_BYTE,null)}else this.textureBuffer.resize(this.width,this.height);a.Texture.frameUpdates.push(this)},b.BitmapFont.prototype.buildBitmapFontText=function(){var a=0,c=0;if(this.multiLine){var d=this._text.split("\n");this.fixedWidth>0?this.resize(fixedWidth,d.length*(this.characterHeight+this.customSpacingY)-this.customSpacingY):this.resize(this.getLongestLine()*(this.characterWidth+this.customSpacingX),d.length*(this.characterHeight+this.customSpacingY)-this.customSpacingY),this.textureBuffer.clear();for(var e=0;ea&&(a=0),this.pasteLine(d[e],a,c,this.customSpacingX),c+=this.characterHeight+this.customSpacingY}}else{switch(this.fixedWidth>0?this.resize(fixedWidth,this.characterHeight):this.resize(this._text.length*(this.characterWidth+this.customSpacingX),this.characterHeight),this.textureBuffer.clear(),this.align){case b.BitmapFont.ALIGN_LEFT:a=0;break;case b.BitmapFont.ALIGN_RIGHT:a=this.width-this._text.length*(this.characterWidth+this.customSpacingX);break;case b.BitmapFont.ALIGN_CENTER:a=this.width/2-this._text.length*(this.characterWidth+this.customSpacingX)/2,a+=this.customSpacingX/2}this.pasteLine(this._text,a,0,this.customSpacingX)}},b.BitmapFont.prototype.pasteLine=function(a,c,d){for(var e=new b.Point,f=0;f=0&&(this.stamp.frame=this.grabData[a.charCodeAt(f)],e.set(c,d),this.render(this.stamp,e,!1),c+=this.characterWidth+this.customSpacingX,c>this.width))break},b.BitmapFont.prototype.getLongestLine=function(){var a=0;if(this._text.length>0)for(var b=this._text.split("\n"),c=0;ca&&(a=b[c].length);return a},b.BitmapFont.prototype.removeUnsupportedCharacters=function(a){for(var b="",c=0;c=0||!a&&"\n"===d)&&(b=b.concat(d))}return b},Object.defineProperty(b.BitmapFont.prototype,"text",{get:function(){return this._text},set:function(a){var b;b=this.autoUpperCase?a.toUpperCase():a,b!==this._text&&(this._text=b,this.removeUnsupportedCharacters(this.multiLine),this.buildBitmapFontText())}}),b.Canvas={create:function(a,b,c){a=a||256,b=b||256;var d=document.createElement("canvas");return"string"==typeof c&&(d.id=c),d.width=a,d.height=b,d.style.display="block",d},getOffset:function(a,c){c=c||new b.Point;var d=a.getBoundingClientRect(),e=a.clientTop||document.body.clientTop||0,f=a.clientLeft||document.body.clientLeft||0,g=0,h=0;return"CSS1Compat"===document.compatMode?(g=window.pageYOffset||document.documentElement.scrollTop||a.scrollTop||0,h=window.pageXOffset||document.documentElement.scrollLeft||a.scrollLeft||0):(g=window.pageYOffset||document.body.scrollTop||a.scrollTop||0,h=window.pageXOffset||document.body.scrollLeft||a.scrollLeft||0),c.x=d.left+h-f,c.y=d.top+g-e,c},getAspectRatio:function(a){return a.width/a.height},setBackgroundColor:function(a,b){return b=b||"rgb(0,0,0)",a.style.backgroundColor=b,a},setTouchAction:function(a,b){return b=b||"none",a.style.msTouchAction=b,a.style["ms-touch-action"]=b,a.style["touch-action"]=b,a},setUserSelect:function(a,b){return b=b||"none",a.style["-webkit-touch-callout"]=b,a.style["-webkit-user-select"]=b,a.style["-khtml-user-select"]=b,a.style["-moz-user-select"]=b,a.style["-ms-user-select"]=b,a.style["user-select"]=b,a.style["-webkit-tap-highlight-color"]="rgba(0, 0, 0, 0)",a},addToDOM:function(a,b,c){var d;return"undefined"==typeof c&&(c=!0),b&&("string"==typeof b?d=document.getElementById(b):"object"==typeof b&&1===b.nodeType&&(d=b)),d||(d=document.body),c&&d.style&&(d.style.overflow="hidden"),d.appendChild(a),a},setTransform:function(a,b,c,d,e,f,g){return a.setTransform(d,f,g,e,b,c),a},setSmoothingEnabled:function(a,b){return a.imageSmoothingEnabled=b,a.mozImageSmoothingEnabled=b,a.oImageSmoothingEnabled=b,a.webkitImageSmoothingEnabled=b,a.msImageSmoothingEnabled=b,a},setImageRenderingCrisp:function(a){return a.style["image-rendering"]="optimizeSpeed",a.style["image-rendering"]="crisp-edges",a.style["image-rendering"]="-moz-crisp-edges",a.style["image-rendering"]="-webkit-optimize-contrast",a.style["image-rendering"]="optimize-contrast",a.style.msInterpolationMode="nearest-neighbor",a},setImageRenderingBicubic:function(a){return a.style["image-rendering"]="auto",a.style.msInterpolationMode="bicubic",a}},b.StageScaleMode=function(a,c,d){this.game=a,this.width=c,this.height=d,this.minWidth=null,this.maxWidth=null,this.minHeight=null,this.maxHeight=null,this.forceLandscape=!1,this.forcePortrait=!1,this.incorrectOrientation=!1,this.pageAlignHorizontally=!1,this.pageAlignVertically=!1,this.maxIterations=5,this.orientationSprite=null,this.enterLandscape=new b.Signal,this.enterPortrait=new b.Signal,this.enterIncorrectOrientation=new b.Signal,this.leaveIncorrectOrientation=new b.Signal,this.hasResized=new b.Signal,this.orientation=0,window.orientation?this.orientation=window.orientation:window.outerWidth>window.outerHeight&&(this.orientation=90),this.scaleFactor=new b.Point(1,1),this.scaleFactorInversed=new b.Point(1,1),this.margin=new b.Point(0,0),this.aspectRatio=0,this.sourceAspectRatio=c/d,this.event=null,this.scaleMode=b.StageScaleMode.NO_SCALE,this.fullScreenScaleMode=b.StageScaleMode.NO_SCALE,this._startHeight=0,this._width=0,this._height=0;var e=this;window.addEventListener("orientationchange",function(a){return e.checkOrientation(a)},!1),window.addEventListener("resize",function(a){return e.checkResize(a)},!1),document.addEventListener("webkitfullscreenchange",function(a){return e.fullScreenChange(a)},!1),document.addEventListener("mozfullscreenchange",function(a){return e.fullScreenChange(a)},!1),document.addEventListener("fullscreenchange",function(a){return e.fullScreenChange(a)},!1)},b.StageScaleMode.EXACT_FIT=0,b.StageScaleMode.NO_SCALE=1,b.StageScaleMode.SHOW_ALL=2,b.StageScaleMode.prototype={startFullScreen:function(a){if(!this.isFullScreen){"undefined"!=typeof a&&b.Canvas.setSmoothingEnabled(this.game.context,a);var c=this.game.canvas;this._width=this.width,this._height=this.height,c.requestFullScreen?c.requestFullScreen():c.mozRequestFullScreen?c.parentNode.mozRequestFullScreen():c.webkitRequestFullScreen&&c.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}},stopFullScreen:function(){document.cancelFullScreen?document.cancelFullScreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen()},fullScreenChange:function(a){this.event=a,this.isFullScreen?this.fullScreenScaleMode===b.StageScaleMode.EXACT_FIT?(this.game.canvas.style.width="100%",this.game.canvas.style.height="100%",this.setMaximum(),this.game.input.scale.setTo(this.game.width/this.width,this.game.height/this.height),this.aspectRatio=this.width/this.height,this.scaleFactor.x=this.game.width/this.width,this.scaleFactor.y=this.game.height/this.height):this.fullScreenScaleMode===b.StageScaleMode.SHOW_ALL&&(this.setShowAll(),this.refresh()):(this.game.canvas.style.width=this.game.width+"px",this.game.canvas.style.height=this.game.height+"px",this.width=this._width,this.height=this._height,this.game.input.scale.setTo(this.game.width/this.width,this.game.height/this.height),this.aspectRatio=this.width/this.height,this.scaleFactor.x=this.game.width/this.width,this.scaleFactor.y=this.game.height/this.height)},forceOrientation:function(b,c,d){"undefined"==typeof c&&(c=!1),this.forceLandscape=b,this.forcePortrait=c,"undefined"!=typeof d&&((null==d||this.game.cache.checkImageKey(d)===!1)&&(d="__default"),this.orientationSprite=new a.Sprite(a.TextureCache[d]),this.orientationSprite.anchor.x=.5,this.orientationSprite.anchor.y=.5,this.orientationSprite.position.x=this.game.width/2,this.orientationSprite.position.y=this.game.height/2,this.checkOrientationState(),this.incorrectOrientation?(this.orientationSprite.visible=!0,this.game.world.visible=!1):(this.orientationSprite.visible=!1,this.game.world.visible=!0),this.game.stage.addChild(this.orientationSprite))},checkOrientationState:function(){this.incorrectOrientation?(this.forceLandscape&&window.innerWidth>window.innerHeight||this.forcePortrait&&window.innerHeight>window.innerWidth)&&(this.game.paused=!1,this.incorrectOrientation=!1,this.leaveIncorrectOrientation.dispatch(),this.orientationSprite&&(this.orientationSprite.visible=!1,this.game.world.visible=!0),this.refresh()):(this.forceLandscape&&window.innerWidthwindow.outerHeight?90:0,this.isLandscape?this.enterLandscape.dispatch(this.orientation,!0,!1):this.enterPortrait.dispatch(this.orientation,!1,!0),this.scaleMode!==b.StageScaleMode.NO_SCALE&&this.refresh(),this.checkOrientationState()},refresh:function(){if(this.game.device.iPad===!1&&this.game.device.webApp===!1&&this.game.device.desktop===!1&&(this.game.device.android&&this.game.device.chrome===!1?window.scrollTo(0,1):window.scrollTo(0,0)),null==this._check&&this.maxIterations>0){this._iterations=this.maxIterations;var a=this;this._check=window.setInterval(function(){return a.setScreenSize()},10),this.setScreenSize()}},setScreenSize:function(a){"undefined"==typeof a&&(a=!1),this.game.device.iPad===!1&&this.game.device.webApp===!1&&this.game.device.desktop===!1&&(this.game.device.android&&this.game.device.chrome===!1?window.scrollTo(0,1):window.scrollTo(0,0)),this._iterations--,(a||window.innerHeight>this._startHeight||this._iterations<0)&&(document.documentElement.style.minHeight=window.innerHeight+"px",this.incorrectOrientation===!0?this.setMaximum():this.isFullScreen?this.fullScreenScaleMode==b.StageScaleMode.EXACT_FIT?this.setExactFit():this.fullScreenScaleMode==b.StageScaleMode.SHOW_ALL&&this.setShowAll():this.scaleMode==b.StageScaleMode.EXACT_FIT?this.setExactFit():this.scaleMode==b.StageScaleMode.SHOW_ALL&&this.setShowAll(),this.setSize(),clearInterval(this._check),this._check=null)},setSize:function(){this.incorrectOrientation===!1&&(this.maxWidth&&this.width>this.maxWidth&&(this.width=this.maxWidth),this.maxHeight&&this.height>this.maxHeight&&(this.height=this.maxHeight),this.minWidth&&this.widththis.maxWidth?this.maxWidth:a,this.height=this.maxHeight&&b>this.maxHeight?this.maxHeight:b}},b.StageScaleMode.prototype.constructor=b.StageScaleMode,Object.defineProperty(b.StageScaleMode.prototype,"isFullScreen",{get:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement}}),Object.defineProperty(b.StageScaleMode.prototype,"isPortrait",{get:function(){return 0===this.orientation||180==this.orientation}}),Object.defineProperty(b.StageScaleMode.prototype,"isLandscape",{get:function(){return 90===this.orientation||-90===this.orientation}}),b.Device=function(){this.patchAndroidClearRectBug=!1,this.desktop=!1,this.iOS=!1,this.cocoonJS=!1,this.ejecta=!1,this.android=!1,this.chromeOS=!1,this.linux=!1,this.macOS=!1,this.windows=!1,this.canvas=!1,this.file=!1,this.fileSystem=!1,this.localStorage=!1,this.webGL=!1,this.worker=!1,this.touch=!1,this.mspointer=!1,this.css3D=!1,this.pointerLock=!1,this.typedArray=!1,this.vibration=!1,this.quirksMode=!1,this.arora=!1,this.chrome=!1,this.epiphany=!1,this.firefox=!1,this.ie=!1,this.ieVersion=0,this.trident=!1,this.tridentVersion=0,this.mobileSafari=!1,this.midori=!1,this.opera=!1,this.safari=!1,this.webApp=!1,this.silk=!1,this.audioData=!1,this.webAudio=!1,this.ogg=!1,this.opus=!1,this.mp3=!1,this.wav=!1,this.m4a=!1,this.webm=!1,this.iPhone=!1,this.iPhone4=!1,this.iPad=!1,this.pixelRatio=0,this.littleEndian=!1,this._checkAudio(),this._checkBrowser(),this._checkCSS3D(),this._checkDevice(),this._checkFeatures(),this._checkOS()},b.Device.prototype={_checkOS:function(){var a=navigator.userAgent;/Android/.test(a)?this.android=!0:/CrOS/.test(a)?this.chromeOS=!0:/iP[ao]d|iPhone/i.test(a)?this.iOS=!0:/Linux/.test(a)?this.linux=!0:/Mac OS/.test(a)?this.macOS=!0:/Windows/.test(a)&&(this.windows=!0),(this.windows||this.macOS||this.linux&&this.silk===!1)&&(this.desktop=!0)},_checkFeatures:function(){this.canvas=!!window.CanvasRenderingContext2D;try{this.localStorage=!!localStorage.getItem}catch(a){this.localStorage=!1}this.file=!!(window.File&&window.FileReader&&window.FileList&&window.Blob),this.fileSystem=!!window.requestFileSystem,this.webGL=function(){try{var a=document.createElement("canvas");return!!window.WebGLRenderingContext&&(a.getContext("webgl")||a.getContext("experimental-webgl"))}catch(b){return!1}}(),this.webGL=null===this.webGL||this.webGL===!1?!1:!0,this.worker=!!window.Worker,("ontouchstart"in document.documentElement||window.navigator.maxTouchPoints&&window.navigator.maxTouchPoints>1)&&(this.touch=!0),(window.navigator.msPointerEnabled||window.navigator.pointerEnabled)&&(this.mspointer=!0),this.pointerLock="pointerLockElement"in document||"mozPointerLockElement"in document||"webkitPointerLockElement"in document,this.quirksMode="CSS1Compat"===document.compatMode?!1:!0},_checkBrowser:function(){var a=navigator.userAgent;/Arora/.test(a)?this.arora=!0:/Chrome/.test(a)?this.chrome=!0:/Epiphany/.test(a)?this.epiphany=!0:/Firefox/.test(a)?this.firefox=!0:/Mobile Safari/.test(a)?this.mobileSafari=!0:/MSIE (\d+\.\d+);/.test(a)?(this.ie=!0,this.ieVersion=parseInt(RegExp.$1,10)):/Midori/.test(a)?this.midori=!0:/Opera/.test(a)?this.opera=!0:/Safari/.test(a)?this.safari=!0:/Silk/.test(a)?this.silk=!0:/Trident\/(\d+\.\d+); rv:(\d+\.\d+)/.test(a)&&(this.ie=!0,this.trident=!0,this.tridentVersion=parseInt(RegExp.$1,10),this.ieVersion=parseInt(RegExp.$2,10)),navigator.standalone&&(this.webApp=!0),navigator.isCocoonJS&&(this.cocoonJS=!0),"undefined"!=typeof window.ejecta&&(this.ejecta=!0)},_checkAudio:function(){this.audioData=!!window.Audio,this.webAudio=!(!window.webkitAudioContext&&!window.AudioContext);var a=document.createElement("audio"),b=!1;try{(b=!!a.canPlayType)&&(a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")&&(this.ogg=!0),a.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,"")&&(this.opus=!0),a.canPlayType("audio/mpeg;").replace(/^no$/,"")&&(this.mp3=!0),a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,"")&&(this.wav=!0),(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;").replace(/^no$/,""))&&(this.m4a=!0),a.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")&&(this.webm=!0))}catch(c){}},_checkDevice:function(){this.pixelRatio=window.devicePixelRatio||1,this.iPhone=-1!=navigator.userAgent.toLowerCase().indexOf("iphone"),this.iPhone4=2==this.pixelRatio&&this.iPhone,this.iPad=-1!=navigator.userAgent.toLowerCase().indexOf("ipad"),"undefined"!=typeof Int8Array?(this.littleEndian=new Int8Array(new Int16Array([1]).buffer)[0]>0,this.typedArray=!0):(this.littleEndian=!1,this.typedArray=!1),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate,navigator.vibrate&&(this.vibration=!0)},_checkCSS3D:function(){var a,b=document.createElement("p"),c={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.insertBefore(b,null);for(var d in c)void 0!==b.style[d]&&(b.style[d]="translate3d(1px,1px,1px)",a=window.getComputedStyle(b).getPropertyValue(c[d]));document.body.removeChild(b),this.css3D=void 0!==a&&a.length>0&&"none"!==a},canPlayAudio:function(a){return"mp3"==a&&this.mp3?!0:"ogg"==a&&(this.ogg||this.opus)?!0:"m4a"==a&&this.m4a?!0:"wav"==a&&this.wav?!0:"webm"==a&&this.webm?!0:!1},isConsoleOpen:function(){return window.console&&window.console.firebug?!0:window.console?(console.profile(),console.profileEnd(),console.clear&&console.clear(),console.profiles.length>0):!1}},b.Device.prototype.constructor=b.Device,b.RequestAnimationFrame=function(a){this.game=a,this.isRunning=!1;for(var b=["ms","moz","webkit","o"],c=0;ca},fuzzyGreaterThan:function(a,b,c){return"undefined"==typeof c&&(c=1e-4),a>b-c},fuzzyCeil:function(a,b){return"undefined"==typeof b&&(b=1e-4),Math.ceil(a-b)},fuzzyFloor:function(a,b){return"undefined"==typeof b&&(b=1e-4),Math.floor(a+b)},average:function(){for(var a=[],b=0;b0?Math.floor(a):Math.ceil(a)},shear:function(a){return a%1},snapTo:function(a,b,c){return"undefined"==typeof c&&(c=0),0===b?a:(a-=c,a=b*Math.round(a/b),c+a)},snapToFloor:function(a,b,c){return"undefined"==typeof c&&(c=0),0===b?a:(a-=c,a=b*Math.floor(a/b),c+a)},snapToCeil:function(a,b,c){return"undefined"==typeof c&&(c=0),0===b?a:(a-=c,a=b*Math.ceil(a/b),c+a)},snapToInArray:function(a,b,c){if("undefined"==typeof c&&(c=!0),c&&b.sort(),a=f-a?f:e},roundTo:function(a,b,c){"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=10);var d=Math.pow(c,-b);return Math.round(a*d)/d},floorTo:function(a,b,c){"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=10);var d=Math.pow(c,-b);return Math.floor(a*d)/d},ceilTo:function(a,b,c){"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=10);var d=Math.pow(c,-b);return Math.ceil(a*d)/d},interpolateFloat:function(a,b,c){return(b-a)*c+a},angleBetween:function(a,b,c,d){return Math.atan2(c-a,d-b)},angleBetweenPoints:function(a,b){return Math.atan2(b.x-a.x,b.y-a.y)},reverseAngle:function(a){return this.normalizeAngle(a+Math.PI,!0)},normalizeAngle:function(a){return a%=2*Math.PI,a>=0?a:a+2*Math.PI},normalizeLatitude:function(a){return Math.max(-90,Math.min(90,a))},normalizeLongitude:function(a){return 180==a%360?180:(a%=360,-180>a?a+360:a>180?a-360:a)},nearestAngleBetween:function(a,b,c){"undefined"==typeof c&&(c=!0);var d=c?Math.PI:180;return a=this.normalizeAngle(a,c),b=this.normalizeAngle(b,c),-d/2>a&&b>d/2&&(a+=2*d),-d/2>b&&a>d/2&&(b+=2*d),b-a},interpolateAngles:function(a,b,c,d,e){return"undefined"==typeof d&&(d=!0),"undefined"==typeof e&&(e=null),a=this.normalizeAngle(a,d),b=this.normalizeAngleToAnother(b,a,d),"function"==typeof e?e(c,a,b-a,1):this.interpolateFloat(a,b,c)},chanceRoll:function(a){return"undefined"==typeof a&&(a=50),0>=a?!1:a>=100?!0:100*Math.random()>=a?!1:!0},numberArray:function(a,b){for(var c=[],d=a;b>=d;d++)c.push(d);return c},maxAdd:function(a,b,c){return a+=b,a>c&&(a=c),a},minSub:function(a,b,c){return a-=b,c>a&&(a=c),a},wrap:function(a,b,c){var d=c-b;if(0>=d)return 0;var e=(a-b)%d;return 0>e&&(e+=d),e+b},wrapValue:function(a,b,c){var d;return a=Math.abs(a),b=Math.abs(b),c=Math.abs(c),d=(a+b)%c},randomSign:function(){return Math.random()>.5?1:-1},isOdd:function(a){return 1&a},isEven:function(a){return 1&a?!1:!0},max:function(){for(var a=1,b=0,c=arguments.length;c>a;a++)arguments[b]b;b++)a[b]b;b++)a[b]>a[c]&&(c=b);return a[c]},minProperty:function(a){if(2===arguments.length&&"object"==typeof arguments[1])var b=arguments[1];else var b=arguments.slice(1);for(var c=1,d=0,e=b.length;e>c;c++)b[c][a]c;c++)b[c][a]>b[d][a]&&(d=c);return b[d][a]},wrapAngle:function(a){return this.wrap(a,-180,180)},angleLimit:function(a,b,c){var d=a;return a>c?d=c:b>a&&(d=b),d},linearInterpolation:function(a,b){var c=a.length-1,d=c*b,e=Math.floor(d);return 0>b?this.linear(a[0],a[1],d):b>1?this.linear(a[c],a[c-1],c-d):this.linear(a[e],a[e+1>c?c:e+1],d-e)},bezierInterpolation:function(a,b){for(var c=0,d=a.length-1,e=0;d>=e;e++)c+=Math.pow(1-b,d-e)*Math.pow(b,e)*a[e]*this.bernstein(d,e);return c},catmullRomInterpolation:function(a,b){var c=a.length-1,d=c*b,e=Math.floor(d);return a[0]===a[c]?(0>b&&(e=Math.floor(d=c*(1+b))),this.catmullRom(a[(e-1+c)%c],a[e],a[(e+1)%c],a[(e+2)%c],d-e)):0>b?a[0]-(this.catmullRom(a[0],a[0],a[1],a[1],-d)-a[0]):b>1?a[c]-(this.catmullRom(a[c],a[c],a[c-1],a[c-1],d-c)-a[c]):this.catmullRom(a[e?e-1:0],a[e],a[e+1>c?c:e+1],a[e+2>c?c:e+2],d-e)},linear:function(a,b,c){return(b-a)*c+a},bernstein:function(a,b){return this.factorial(a)/this.factorial(b)/this.factorial(a-b)},catmullRom:function(a,b,c,d,e){var f=.5*(c-a),g=.5*(d-b),h=e*e,i=e*h;return(2*b-2*c+f+g)*i+(-3*b+3*c-2*f-g)*h+f*e+b},difference:function(a,b){return Math.abs(a-b)},getRandom:function(a,b,c){if("undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=0),null!=a){var d=c;if((0===d||d>a.length-b)&&(d=a.length-b),d>0)return a[b+Math.floor(Math.random()*d)]}return null},floor:function(a){var b=0|a;return a>0?b:b!=a?b-1:b},ceil:function(a){var b=0|a;return a>0?b!=a?b+1:b:b},sinCosGenerator:function(a,b,c,d){"undefined"==typeof b&&(b=1),"undefined"==typeof c&&(c=1),"undefined"==typeof d&&(d=1);for(var e=b,f=c,g=d*Math.PI/a,h=[],i=[],j=0;a>j;j++)f-=e*g,e+=f*g,h[j]=f,i[j]=e;return{sin:i,cos:h,length:a}},shift:function(a){var b=a.shift();return a.push(b),b},shuffleArray:function(a){for(var b=a.length-1;b>0;b--){var c=Math.floor(Math.random()*(b+1)),d=a[b];a[b]=a[c],a[c]=d}return a},distance:function(a,b,c,d){var e=a-c,f=b-d;return Math.sqrt(e*e+f*f)},distancePow:function(a,b,c,d,e){return"undefined"==typeof e&&(e=2),Math.sqrt(Math.pow(c-a,e)+Math.pow(d-b,e))},distanceRounded:function(a,c,d,e){return Math.round(b.Math.distance(a,c,d,e))},clamp:function(a,b,c){return b>a?b:a>c?c:a -},clampBottom:function(a,b){return b>a?b:a},within:function(a,b,c){return Math.abs(a-b)<=c},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a,b,c){return b>=a?0:a>=c?1:(a=(a-b)/(c-b),a*a*(3-2*a))},smootherstep:function(a,b,c){return b>=a?0:a>=c?1:(a=(a-b)/(c-b),a*a*a*(a*(6*a-15)+10))},sign:function(a){return 0>a?-1:a>0?1:0},p2px:function(a){return a*=-20},px2p:function(a){return a*-.05},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}()},b.RandomDataGenerator=function(a){"undefined"==typeof a&&(a=[]),this.c=1,this.s0=0,this.s1=0,this.s2=0,this.sow(a)},b.RandomDataGenerator.prototype={rnd:function(){var a=2091639*this.s0+2.3283064365386963e-10*this.c;return this.c=0|a,this.s0=this.s1,this.s1=this.s2,this.s2=a-this.c,this.s2},sow:function(a){"undefined"==typeof a&&(a=[]),this.s0=this.hash(" "),this.s1=this.hash(this.s0),this.s2=this.hash(this.s1),this.c=1;for(var b,c=0;b=a[c++];)this.s0-=this.hash(b),this.s0+=~~(this.s0<0),this.s1-=this.hash(b),this.s1+=~~(this.s1<0),this.s2-=this.hash(b),this.s2+=~~(this.s2<0)},hash:function(a){var b,c,d;for(d=4022871197,a=a.toString(),c=0;c>>0,b-=d,b*=d,d=b>>>0,b-=d,d+=4294967296*b;return 2.3283064365386963e-10*(d>>>0)},integer:function(){return 4294967296*this.rnd.apply(this)},frac:function(){return this.rnd.apply(this)+1.1102230246251565e-16*(0|2097152*this.rnd.apply(this))},real:function(){return this.integer()+this.frac()},integerInRange:function(a,b){return Math.floor(this.realInRange(a,b))},realInRange:function(a,b){return this.frac()*(b-a)+a},normal:function(){return 1-2*this.frac()},uuid:function(){var a="",b="";for(b=a="";a++<36;b+=~a%5|4&3*a?(15^a?8^this.frac()*(20^a?16:4):4).toString(16):"-");return b},pick:function(a){return a[this.integerInRange(0,a.length)]},weightedPick:function(a){return a[~~(Math.pow(this.frac(),2)*a.length)]},timestamp:function(a,b){return this.realInRange(a||9466848e5,b||1577862e6)},angle:function(){return this.integerInRange(-180,180)}},b.RandomDataGenerator.prototype.constructor=b.RandomDataGenerator,b.QuadTree=function(a,b,c,d,e,f,g){this.maxObjects=e||10,this.maxLevels=f||4,this.level=g||0,this.bounds={x:Math.round(a),y:Math.round(b),width:c,height:d,subWidth:Math.floor(c/2),subHeight:Math.floor(d/2),right:Math.round(a)+Math.floor(c/2),bottom:Math.round(b)+Math.floor(d/2)},this.objects=[],this.nodes=[]},b.QuadTree.prototype={populate:function(a){a.forEach(this.populateHandler,this,!0)},populateHandler:function(a){a.body&&a.body.checkCollision.none===!1&&a.alive&&this.insert(a.body)},split:function(){this.level++,this.nodes[0]=new b.QuadTree(this.bounds.right,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level),this.nodes[1]=new b.QuadTree(this.bounds.x,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level),this.nodes[2]=new b.QuadTree(this.bounds.x,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level),this.nodes[3]=new b.QuadTree(this.bounds.right,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level)},insert:function(a){var b,c=0;if(null!=this.nodes[0]&&(b=this.getIndex(a),-1!==b))return this.nodes[b].insert(a),void 0;if(this.objects.push(a),this.objects.length>this.maxObjects&&this.levelthis.bounds.bottom&&(b=2):a.x>this.bounds.right&&(a.ythis.bounds.bottom&&(b=3)),b},retrieve:function(a){var b=this.objects;return a.body.quadTreeIndex=this.getIndex(a.body),this.nodes[0]&&(-1!==a.body.quadTreeIndex?b=b.concat(this.nodes[a.body.quadTreeIndex].retrieve(a)):(b=b.concat(this.nodes[0].retrieve(a)),b=b.concat(this.nodes[1].retrieve(a)),b=b.concat(this.nodes[2].retrieve(a)),b=b.concat(this.nodes[3].retrieve(a)))),b},clear:function(){this.objects=[];for(var a=0,b=this.nodes.length;b>a;a++)this.nodes[a]&&(this.nodes[a].clear(),delete this.nodes[a])}},b.QuadTree.prototype.constructor=b.QuadTree,b.Net=function(a){this.game=a},b.Net.prototype={getHostName:function(){return window.location&&window.location.hostname?window.location.hostname:null},checkDomainName:function(a){return-1!==window.location.hostname.indexOf(a)},updateQueryString:function(a,b,c,d){"undefined"==typeof c&&(c=!1),("undefined"==typeof d||""===d)&&(d=window.location.href);var e="",f=new RegExp("([?|&])"+a+"=.*?(&|#|$)(.*)","gi");if(f.test(d))e="undefined"!=typeof b&&null!==b?d.replace(f,"$1"+a+"="+b+"$2$3"):d.replace(f,"$1$3").replace(/(&|\?)$/,"");else if("undefined"!=typeof b&&null!==b){var g=-1!==d.indexOf("?")?"&":"?",h=d.split("#");d=h[0]+g+a+"="+b,h[1]&&(d+="#"+h[1]),e=d}else e=d;return c?(window.location.href=e,void 0):e},getQueryString:function(a){"undefined"==typeof a&&(a="");var b={},c=location.search.substring(1).split("&");for(var d in c){var e=c[d].split("=");if(e.length>1){if(a&&a==this.decodeURI(e[0]))return this.decodeURI(e[1]);b[this.decodeURI(e[0])]=this.decodeURI(e[1])}}return b},decodeURI:function(a){return decodeURIComponent(a.replace(/\+/g," "))}},b.Net.prototype.constructor=b.Net,b.TweenManager=function(a){this.game=a,this._tweens=[],this._add=[],this.game.onPause.add(this.pauseAll,this),this.game.onResume.add(this.resumeAll,this)},b.TweenManager.prototype={getAll:function(){return this._tweens},removeAll:function(){for(var a=0;aa;)this._tweens[a].update(this.game.time.now)?a++:(this._tweens.splice(a,1),b--);return this._add.length>0&&(this._tweens=this._tweens.concat(this._add),this._add.length=0),!0},isTweening:function(a){return this._tweens.some(function(b){return b._object===a})},pauseAll:function(){for(var a=this._tweens.length-1;a>=0;a--)this._tweens[a].pause()},resumeAll:function(){for(var a=this._tweens.length-1;a>=0;a--)this._tweens[a].resume()}},b.TweenManager.prototype.constructor=b.TweenManager,b.Tween=function(a,c){this._object=a,this.game=c,this._manager=this.game.tweens,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._repeat=0,this._yoyo=!1,this._reversed=!1,this._delayTime=0,this._startTime=null,this._easingFunction=b.Easing.Linear.None,this._interpolationFunction=b.Math.linearInterpolation,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onUpdateCallbackContext=null,this._pausedTime=0,this.pendingDelete=!1;for(var d in a)this._valuesStart[d]=parseFloat(a[d],10);this.onStart=new b.Signal,this.onLoop=new b.Signal,this.onComplete=new b.Signal,this.isRunning=!1},b.Tween.prototype={to:function(a,b,c,d,e,f,g){b=b||1e3,c=c||null,d=d||!1,e=e||0,f=f||0,g=g||!1;var h;return this._parent?(h=this._manager.create(this._object),this._lastChild.chain(h),this._lastChild=h):(h=this,this._parent=this,this._lastChild=this),h._repeat=f,h._duration=b,h._valuesEnd=a,null!==c&&(h._easingFunction=c),e>0&&(h._delayTime=e),h._yoyo=g,d?this.start():this},start:function(){if(null!==this.game&&null!==this._object){this._manager.add(this),this.isRunning=!0,this._onStartCallbackFired=!1,this._startTime=this.game.time.now+this._delayTime;for(var a in this._valuesEnd){if(this._valuesEnd[a]instanceof Array){if(0===this._valuesEnd[a].length)continue;this._valuesEnd[a]=[this._object[a]].concat(this._valuesEnd[a])}this._valuesStart[a]=this._object[a],this._valuesStart[a]instanceof Array==!1&&(this._valuesStart[a]*=1),this._valuesStartRepeat[a]=this._valuesStart[a]||0}return this}},stop:function(){return this.isRunning=!1,this._onUpdateCallback=null,this._manager.remove(this),this},delay:function(a){return this._delayTime=a,this},repeat:function(a){return this._repeat=a,this},yoyo:function(a){return this._yoyo=a,this},easing:function(a){return this._easingFunction=a,this},interpolation:function(a){return this._interpolationFunction=a,this},chain:function(){return this._chainedTweens=arguments,this},loop:function(){return this._lastChild.chain(this),this},onUpdateCallback:function(a,b){return this._onUpdateCallback=a,this._onUpdateCallbackContext=b,this},pause:function(){this._paused=!0,this._pausedTime=this.game.time.now},resume:function(){this._paused=!1,this._startTime+=this.game.time.now-this._pausedTime},update:function(a){if(this.pendingDelete)return!1;if(this._paused||a1?1:c;var d=this._easingFunction(c);for(b in this._valuesEnd){var e=this._valuesStart[b]||0,f=this._valuesEnd[b];f instanceof Array?this._object[b]=this._interpolationFunction(f,d):("string"==typeof f&&(f=e+parseFloat(f,10)),"number"==typeof f&&(this._object[b]=e+(f-e)*d))}if(null!==this._onUpdateCallback&&this._onUpdateCallback.call(this._onUpdateCallbackContext,this,d),1==c){if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(b in this._valuesStartRepeat){if("string"==typeof this._valuesEnd[b]&&(this._valuesStartRepeat[b]=this._valuesStartRepeat[b]+parseFloat(this._valuesEnd[b],10)),this._yoyo){var g=this._valuesStartRepeat[b];this._valuesStartRepeat[b]=this._valuesEnd[b],this._valuesEnd[b]=g,this._reversed=!this._reversed}this._valuesStart[b]=this._valuesStartRepeat[b]}return this._startTime=a+this._delayTime,this.onLoop.dispatch(this._object),!0}this.isRunning=!1,this.onComplete.dispatch(this._object);for(var h=0,i=this._chainedTweens.length;i>h;h++)this._chainedTweens[h].start(a);return!1}return!0}},b.Tween.prototype.constructor=b.Tween,b.Easing={Linear:{None:function(a){return a}},Quadratic:{In:function(a){return a*a},Out:function(a){return a*(2-a)},InOut:function(a){return(a*=2)<1?.5*a*a:-.5*(--a*(a-2)-1)}},Cubic:{In:function(a){return a*a*a},Out:function(a){return--a*a*a+1},InOut:function(a){return(a*=2)<1?.5*a*a*a:.5*((a-=2)*a*a+2)}},Quartic:{In:function(a){return a*a*a*a},Out:function(a){return 1- --a*a*a*a},InOut:function(a){return(a*=2)<1?.5*a*a*a*a:-.5*((a-=2)*a*a*a-2)}},Quintic:{In:function(a){return a*a*a*a*a},Out:function(a){return--a*a*a*a*a+1},InOut:function(a){return(a*=2)<1?.5*a*a*a*a*a:.5*((a-=2)*a*a*a*a+2)}},Sinusoidal:{In:function(a){return 1-Math.cos(a*Math.PI/2)},Out:function(a){return Math.sin(a*Math.PI/2)},InOut:function(a){return.5*(1-Math.cos(Math.PI*a))}},Exponential:{In:function(a){return 0===a?0:Math.pow(1024,a-1)},Out:function(a){return 1===a?1:1-Math.pow(2,-10*a)},InOut:function(a){return 0===a?0:1===a?1:(a*=2)<1?.5*Math.pow(1024,a-1):.5*(-Math.pow(2,-10*(a-1))+2)}},Circular:{In:function(a){return 1-Math.sqrt(1-a*a)},Out:function(a){return Math.sqrt(1- --a*a)},InOut:function(a){return(a*=2)<1?-.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)}},Elastic:{In:function(a){var b,c=.1,d=.4;return 0===a?0:1===a?1:(!c||1>c?(c=1,b=d/4):b=d*Math.asin(1/c)/(2*Math.PI),-(c*Math.pow(2,10*(a-=1))*Math.sin((a-b)*2*Math.PI/d)))},Out:function(a){var b,c=.1,d=.4;return 0===a?0:1===a?1:(!c||1>c?(c=1,b=d/4):b=d*Math.asin(1/c)/(2*Math.PI),c*Math.pow(2,-10*a)*Math.sin((a-b)*2*Math.PI/d)+1)},InOut:function(a){var b,c=.1,d=.4;return 0===a?0:1===a?1:(!c||1>c?(c=1,b=d/4):b=d*Math.asin(1/c)/(2*Math.PI),(a*=2)<1?-.5*c*Math.pow(2,10*(a-=1))*Math.sin((a-b)*2*Math.PI/d):.5*c*Math.pow(2,-10*(a-=1))*Math.sin((a-b)*2*Math.PI/d)+1)}},Back:{In:function(a){var b=1.70158;return a*a*((b+1)*a-b)},Out:function(a){var b=1.70158;return--a*a*((b+1)*a+b)+1},InOut:function(a){var b=2.5949095;return(a*=2)<1?.5*a*a*((b+1)*a-b):.5*((a-=2)*a*((b+1)*a+b)+2)}},Bounce:{In:function(a){return 1-b.Easing.Bounce.Out(1-a)},Out:function(a){return 1/2.75>a?7.5625*a*a:2/2.75>a?7.5625*(a-=1.5/2.75)*a+.75:2.5/2.75>a?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},InOut:function(a){return.5>a?.5*b.Easing.Bounce.In(2*a):.5*b.Easing.Bounce.Out(2*a-1)+.5}}},b.Time=function(a){this.game=a,this.time=0,this.now=0,this.elapsed=0,this.pausedTime=0,this.fps=0,this.fpsMin=1e3,this.fpsMax=0,this.msMin=1e3,this.msMax=0,this.physicsElapsed=0,this.frames=0,this.pauseDuration=0,this.timeToCall=0,this.lastTime=0,this.events=new b.Timer(this.game,!1),this._started=0,this._timeLastSecond=0,this._pauseStarted=0,this._justResumed=!1,this._timers=[],this._len=0,this._i=0,this.game.onPause.add(this.gamePaused,this),this.game.onResume.add(this.gameResumed,this)},b.Time.prototype={boot:function(){this.events.start()},create:function(a){"undefined"==typeof a&&(a=!0);var c=new b.Timer(this.game,a);return this._timers.push(c),c},removeAll:function(){for(var a=0;athis._timeLastSecond+1e3&&(this.fps=Math.round(1e3*this.frames/(this.now-this._timeLastSecond)),this.fpsMin=this.game.math.min(this.fpsMin,this.fps),this.fpsMax=this.game.math.max(this.fpsMax,this.fps),this._timeLastSecond=this.now,this.frames=0),this.time=this.now,this.lastTime=a+this.timeToCall,this.physicsElapsed=1*(this.elapsed/1e3),this.physicsElapsed>.05&&(this.physicsElapsed=.05),this.game.paused)this.pausedTime=this.now-this._pauseStarted;else for(this.events.update(this.now),this._i=0,this._len=this._timers.length;this._i0&&(this.events.sort(this.sortHandler),this.nextTick=this.events[0].tick)},sortHandler:function(a,b){return a.tickb.tick?1:0},update:function(a){if(this.paused)return!0;for(this._now=a-this._started,this._len=this.events.length,this._i=0;this._i=this.nextTick&&this._len>0){for(this._i=0;this._i=this.events[this._i].tick;)this.events[this._i].loop===!0?(this.events[this._i].tick+=this.events[this._i].delay-(this._now-this.events[this._i].tick),this.events[this._i].callback.apply(this.events[this._i].callbackContext,this.events[this._i].args)):this.events[this._i].repeatCount>0?(this.events[this._i].repeatCount--,this.events[this._i].tick+=this.events[this._i].delay-(this._now-this.events[this._i].tick),this.events[this._i].callback.apply(this.events[this._i].callbackContext,this.events[this._i].args)):(this.events[this._i].callback.apply(this.events[this._i].callbackContext,this.events[this._i].args),this.events.splice(this._i,1),this._len--),this._i++;this.events.length>0?this.order():(this.expired=!0,this.onComplete.dispatch(this))}return this.expired&&this.autoDestroy?!1:!0},pause:function(){this.running&&!this.expired&&(this._pauseStarted=this.game.time.now,this.paused=!0)},resume:function(){if(this.running&&!this.expired){for(var a=this.game.time.now-this._pauseStarted,b=0;bthis._now?this.nextTick-this._now:0}}),Object.defineProperty(b.Timer.prototype,"length",{get:function(){return this.events.length}}),Object.defineProperty(b.Timer.prototype,"ms",{get:function(){return this._now}}),Object.defineProperty(b.Timer.prototype,"seconds",{get:function(){return.001*this._now}}),b.Timer.prototype.constructor=b.Timer,b.TimerEvent=function(a,b,c,d,e,f,g,h){this.timer=a,this.delay=b,this.tick=c,this.repeatCount=d-1,this.loop=e,this.callback=f,this.callbackContext=g,this.args=h,this.pendingDelete=!1},b.TimerEvent.prototype.constructor=b.TimerEvent,b.AnimationManager=function(a){this.sprite=a,this.game=a.game,this.currentFrame=null,this.updateIfVisible=!0,this.isLoaded=!1,this._frameData=null,this._anims={},this._outputFrames=[]},b.AnimationManager.prototype={loadFrameData:function(a){this._frameData=a,this.frame=0,this.isLoaded=!0},add:function(c,d,e,f,g){return null==this._frameData?(console.warn("No FrameData available for Phaser.Animation "+c),void 0):(e=e||60,"undefined"==typeof f&&(f=!1),"undefined"==typeof g&&(g=d&&"number"==typeof d[0]?!0:!1),null==this.sprite.events.onAnimationStart&&(this.sprite.events.onAnimationStart=new b.Signal,this.sprite.events.onAnimationComplete=new b.Signal,this.sprite.events.onAnimationLoop=new b.Signal),this._outputFrames.length=0,this._frameData.getFrameIndexes(d,g,this._outputFrames),this._anims[c]=new b.Animation(this.game,this.sprite,c,this._frameData,this._outputFrames,e,f),this.currentAnim=this._anims[c],this.currentFrame=this.currentAnim.currentFrame,this.sprite.setTexture(a.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1),this._anims[c])},validateFrames:function(a,b){"undefined"==typeof b&&(b=!0);for(var c=0;cthis._frameData.total)return!1}else if(this._frameData.checkFrameName(a[c])===!1)return!1;return!0},play:function(a,b,c,d){if(this._anims[a]){if(this.currentAnim!=this._anims[a])return this.currentAnim=this._anims[a],this.currentAnim.paused=!1,this.currentAnim.play(b,c,d);if(this.currentAnim.isPlaying===!1)return this.currentAnim.paused=!1,this.currentAnim.play(b,c,d)}},stop:function(a,b){"undefined"==typeof b&&(b=!1),"string"==typeof a?this._anims[a]&&(this.currentAnim=this._anims[a],this.currentAnim.stop(b)):this.currentAnim&&this.currentAnim.stop(b)},update:function(){return this.updateIfVisible&&this.sprite.visible===!1?!1:this.currentAnim&&this.currentAnim.update()===!0?(this.currentFrame=this.currentAnim.currentFrame,!0):!1},getAnimation:function(a){return"string"==typeof a&&this._anims[a]?this._anims[a]:null},refreshFrame:function(){this.sprite.setTexture(a.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1)},destroy:function(){this._anims={},this._frameData=null,this._frameIndex=0,this.currentAnim=null,this.currentFrame=null}},b.AnimationManager.prototype.constructor=b.AnimationManager,Object.defineProperty(b.AnimationManager.prototype,"frameData",{get:function(){return this._frameData}}),Object.defineProperty(b.AnimationManager.prototype,"frameTotal",{get:function(){return this._frameData?this._frameData.total:-1}}),Object.defineProperty(b.AnimationManager.prototype,"paused",{get:function(){return this.currentAnim.isPaused},set:function(a){this.currentAnim.paused=a}}),Object.defineProperty(b.AnimationManager.prototype,"frame",{get:function(){return this.currentFrame?this._frameIndex:void 0},set:function(b){"number"==typeof b&&this._frameData&&null!==this._frameData.getFrame(b)&&(this.currentFrame=this._frameData.getFrame(b),this._frameIndex=b,this.sprite.setTexture(a.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1))}}),Object.defineProperty(b.AnimationManager.prototype,"frameName",{get:function(){return this.currentFrame?this.currentFrame.name:void 0},set:function(b){"string"==typeof b&&this._frameData&&null!==this._frameData.getFrameByName(b)?(this.currentFrame=this._frameData.getFrameByName(b),this._frameIndex=this.currentFrame.index,this.sprite.setTexture(a.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1)):console.warn("Cannot set frameName: "+b)}}),b.Animation=function(a,b,c,d,e,f,g){this.game=a,this._parent=b,this._frameData=d,this.name=c,this._frames=[],this._frames=this._frames.concat(e),this.delay=1e3/f,this.looped=g,this.killOnComplete=!1,this.isFinished=!1,this.isPlaying=!1,this.isPaused=!1,this._pauseStartTime=0,this._frameIndex=0,this._frameDiff=0,this._frameSkip=1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex])},b.Animation.prototype={play:function(b,c,d){return"number"==typeof b&&(this.delay=1e3/b),"boolean"==typeof c&&(this.looped=c),"undefined"!=typeof d&&(this.killOnComplete=d),this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this._timeLastFrame=this.game.time.now,this._timeNextFrame=this.game.time.now+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this._parent.setTexture(a.TextureCache[this.currentFrame.uuid]),this._parent.__tilePattern&&(this._parent.__tilePattern=!1,this._parent.tilingTexture=!1),this._parent.events&&this._parent.events.onAnimationStart.dispatch(this._parent,this),this},restart:function(){this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this._timeLastFrame=this.game.time.now,this._timeNextFrame=this.game.time.now+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex])},stop:function(a){"undefined"==typeof a&&(a=!1),this.isPlaying=!1,this.isFinished=!0,this.paused=!1,a&&(this.currentFrame=this._frameData.getFrame(this._frames[0]))},update:function(){return this.isPaused?!1:this.isPlaying===!0&&this.game.time.now>=this._timeNextFrame?(this._frameSkip=1,this._frameDiff=this.game.time.now-this._timeNextFrame,this._timeLastFrame=this.game.time.now,this._frameDiff>this.delay&&(this._frameSkip=Math.floor(this._frameDiff/this.delay),this._frameDiff-=this._frameSkip*this.delay),this._timeNextFrame=this.game.time.now+(this.delay-this._frameDiff),this._frameIndex+=this._frameSkip,this._frameIndex>=this._frames.length?this.looped?(this._frameIndex%=this._frames.length,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&(this._parent.setTexture(a.TextureCache[this.currentFrame.uuid]),this._parent.__tilePattern&&(this._parent.__tilePattern=!1,this._parent.tilingTexture=!1)),this._parent.events.onAnimationLoop.dispatch(this._parent,this)):this.onComplete():(this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&(this._parent.setTexture(a.TextureCache[this.currentFrame.uuid]),this._parent.__tilePattern&&(this._parent.__tilePattern=!1,this._parent.tilingTexture=!1))),!0):!1},destroy:function(){this.game=null,this._parent=null,this._frames=null,this._frameData=null,this.currentFrame=null,this.isPlaying=!1},onComplete:function(){this.isPlaying=!1,this.isFinished=!0,this.paused=!1,this._parent.events&&this._parent.events.onAnimationComplete.dispatch(this._parent,this),this.killOnComplete&&this._parent.kill()}},b.Animation.prototype.constructor=b.Animation,Object.defineProperty(b.Animation.prototype,"paused",{get:function(){return this.isPaused},set:function(a){this.isPaused=a,a?this._pauseStartTime=this.game.time.now:this.isPlaying&&(this._timeNextFrame=this.game.time.now+this.delay)}}),Object.defineProperty(b.Animation.prototype,"frameTotal",{get:function(){return this._frames.length}}),Object.defineProperty(b.Animation.prototype,"frame",{get:function(){return null!==this.currentFrame?this.currentFrame.index:this._frameIndex},set:function(b){this.currentFrame=this._frameData.getFrame(b),null!==this.currentFrame&&(this._frameIndex=b,this._parent.setTexture(a.TextureCache[this.currentFrame.uuid]))}}),b.Animation.generateFrameNames=function(a,c,d,e,f){"undefined"==typeof e&&(e="");var g=[],h="";if(d>c)for(var i=c;d>=i;i++)h="number"==typeof f?b.Utils.pad(i.toString(),f,"0",1):i.toString(),h=a+h+e,g.push(h);else for(var i=c;i>=d;i--)h="number"==typeof f?b.Utils.pad(i.toString(),f,"0",1):i.toString(),h=a+h+e,g.push(h);return g},b.Frame=function(a,c,d,e,f,g,h){this.index=a,this.x=c,this.y=d,this.width=e,this.height=f,this.name=g,this.uuid=h,this.centerX=Math.floor(e/2),this.centerY=Math.floor(f/2),this.distance=b.Math.distance(0,0,e,f),this.rotated=!1,this.rotationDirection="cw",this.trimmed=!1,this.sourceSizeW=e,this.sourceSizeH=f,this.spriteSourceSizeX=0,this.spriteSourceSizeY=0,this.spriteSourceSizeW=0,this.spriteSourceSizeH=0},b.Frame.prototype={setTrim:function(a,b,c,d,e,f,g){this.trimmed=a,a&&(this.width=b,this.height=c,this.sourceSizeW=b,this.sourceSizeH=c,this.centerX=Math.floor(b/2),this.centerY=Math.floor(c/2),this.spriteSourceSizeX=d,this.spriteSourceSizeY=e,this.spriteSourceSizeW=f,this.spriteSourceSizeH=g)},getRect:function(a){return"undefined"==typeof a?a=new b.Rectangle(this.x,this.y,this.width,this.height):a.setTo(this.x,this.y,this.width,this.height),a}},b.Frame.prototype.constructor=b.Frame,b.FrameData=function(){this._frames=[],this._frameNames=[]},b.FrameData.prototype={addFrame:function(a){return a.index=this._frames.length,this._frames.push(a),""!==a.name&&(this._frameNames[a.name]=a.index),a},getFrame:function(a){return a>this._frames.length&&(a=0),this._frames[a]},getFrameByName:function(a){return"number"==typeof this._frameNames[a]?this._frames[this._frameNames[a]]:null},checkFrameName:function(a){return null==this._frameNames[a]?!1:!0},getFrameRange:function(a,b,c){"undefined"==typeof c&&(c=[]);for(var d=a;b>=d;d++)c.push(this._frames[d]);return c},getFrames:function(a,b,c){if("undefined"==typeof b&&(b=!0),"undefined"==typeof c&&(c=[]),"undefined"==typeof a||0===a.length)for(var d=0;dd;d++)b?c.push(this.getFrame(a[d])):c.push(this.getFrameByName(a[d]));return c},getFrameIndexes:function(a,b,c){if("undefined"==typeof b&&(b=!0),"undefined"==typeof c&&(c=[]),"undefined"==typeof a||0===a.length)for(var d=0,e=this._frames.length;e>d;d++)c.push(this._frames[d].index);else for(var d=0,e=a.length;e>d;d++)b?c.push(a[d]):this.getFrameByName(a[d])&&c.push(this.getFrameByName(a[d]).index);return c}},b.FrameData.prototype.constructor=b.FrameData,Object.defineProperty(b.FrameData.prototype,"total",{get:function(){return this._frames.length}}),b.AnimationParser={spriteSheet:function(c,d,e,f,g,h,i){var j=c.cache.getImage(d);if(null==j)return null;var k=j.width,l=j.height;0>=e&&(e=Math.floor(-k/Math.min(-1,e))),0>=f&&(f=Math.floor(-l/Math.min(-1,f)));var m=Math.round(k/e),n=Math.round(l/f),o=m*n;if(-1!==g&&(o=g),0===k||0===l||e>k||f>l||0===o)return console.warn("Phaser.AnimationParser.spriteSheet: width/height zero or width/height < given frameWidth/frameHeight"),null;for(var p=new b.FrameData,q=h,r=h,s=0;o>s;s++){var t=c.rnd.uuid();p.addFrame(new b.Frame(s,q,r,e,f,"",t)),a.TextureCache[t]=new a.Texture(a.BaseTextureCache[d],{x:q,y:r,width:e,height:f}),q+=e+i,q===k&&(q=h,r+=f+i)}return p},JSONData:function(c,d,e){if(!d.frames)return console.warn("Phaser.AnimationParser.JSONData: Invalid Texture Atlas JSON given, missing 'frames' array"),console.log(d),void 0;for(var f,g=new b.FrameData,h=d.frames,i=0;i tag"),void 0;for(var f,g,h,i,j,k,l,m,n,o,p,q,r=new b.FrameData,s=d.getElementsByTagName("SubTexture"),t=0;t0)for(var c=0;c0)for(var c=0;c0?(this._fileIndex=0,this._progressChunk=100/this._fileList.length,this.loadFile()):(this.progress=100,this.progressFloat=100,this.hasLoaded=!0,this.onLoadComplete.dispatch()))},loadFile:function(){if(!this._fileList[this._fileIndex])return console.warn("Phaser.Loader loadFile invalid index "+this._fileIndex),void 0;var a=this._fileList[this._fileIndex],c=this;switch(a.type){case"image":case"spritesheet":case"textureatlas":case"bitmapfont":a.data=new Image,a.data.name=a.key,a.data.onload=function(){return c.fileComplete(c._fileIndex)},a.data.onerror=function(){return c.fileError(c._fileIndex)},this.crossOrigin&&(a.data.crossOrigin=this.crossOrigin),a.data.src=this.baseURL+a.url;break;case"audio":a.url=this.getAudioURL(a.url),null!==a.url?this.game.sound.usingWebAudio?(this._xhr.open("GET",this.baseURL+a.url,!0),this._xhr.responseType="arraybuffer",this._xhr.onload=function(){return c.fileComplete(c._fileIndex)},this._xhr.onerror=function(){return c.fileError(c._fileIndex)},this._xhr.send()):this.game.sound.usingAudioTag&&(this.game.sound.touchLocked?(a.data=new Audio,a.data.name=a.key,a.data.preload="auto",a.data.src=this.baseURL+a.url,this.fileComplete(this._fileIndex)):(a.data=new Audio,a.data.name=a.key,a.data.onerror=function(){return c.fileError(c._fileIndex)},a.data.preload="auto",a.data.src=this.baseURL+a.url,a.data.addEventListener("canplaythrough",b.GAMES[this.game.id].load.fileComplete(this._fileIndex),!1),a.data.load())):this.fileError(this._fileIndex);break;case"tilemap":if(this._xhr.open("GET",this.baseURL+a.url,!0),this._xhr.responseType="text",a.format===b.Tilemap.TILED_JSON)this._xhr.onload=function(){return c.jsonLoadComplete(c._fileIndex)};else{if(a.format!==b.Tilemap.CSV)throw new Error("Phaser.Loader. Invalid Tilemap format: "+a.format);this._xhr.onload=function(){return c.csvLoadComplete(c._fileIndex)}}this._xhr.onerror=function(){return c.dataLoadError(c._fileIndex)},this._xhr.send();break;case"text":case"script":case"physics":this._xhr.open("GET",this.baseURL+a.url,!0),this._xhr.responseType="text",this._xhr.onload=function(){return c.fileComplete(c._fileIndex)},this._xhr.onerror=function(){return c.fileError(c._fileIndex)},this._xhr.send();break;case"binary":this._xhr.open("GET",this.baseURL+a.url,!0),this._xhr.responseType="arraybuffer",this._xhr.onload=function(){return c.fileComplete(c._fileIndex)},this._xhr.onerror=function(){return c.fileError(c._fileIndex)},this._xhr.send()}},getAudioURL:function(a){var b;"string"==typeof a&&(a=[a]);for(var c=0;c100&&(this.progress=100),null!==this.preloadSprite&&(0===this.preloadSprite.direction?this.preloadSprite.crop.width=Math.floor(this.preloadSprite.width/100*this.progress):this.preloadSprite.crop.height=Math.floor(this.preloadSprite.height/100*this.progress)),this.onFileComplete.dispatch(this.progress,this._fileList[a].key,b,this.totalLoadedFiles(),this._fileList.length),this.totalQueuedFiles()>0?(this._fileIndex++,this.loadFile()):(this.hasLoaded=!0,this.isLoading=!1,this.removeAll(),this.onLoadComplete.dispatch())},totalLoadedFiles:function(){for(var a=0,b=0;b=this.durationMS&&(this.usingWebAudio?this.loop?(this.onLoop.dispatch(this),""===this.currentMarker?(this.currentTime=0,this.startTime=this.game.time.now):this.play(this.currentMarker,0,this.volume,!0,!0)):this.stop():this.loop?(this.onLoop.dispatch(this),this.play(this.currentMarker,0,this.volume,!0,!0)):this.stop()))},play:function(a,b,c,d,e){if(a=a||"",b=b||0,"undefined"==typeof c&&(c=this._volume),"undefined"==typeof d&&(d=!1),"undefined"==typeof e&&(e=!0),this.isPlaying!==!0||e!==!1||this.override!==!1){if(this.isPlaying&&this.override&&(this.usingWebAudio?"undefined"==typeof this._sound.stop?this._sound.noteOff(0):this._sound.stop(0):this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0)),this.currentMarker=a,""!==a){if(!this.markers[a])return console.warn("Phaser.Sound.play: audio marker "+a+" doesn't exist"),void 0;this.position=this.markers[a].start,this.volume=this.markers[a].volume,this.loop=this.markers[a].loop,this.duration=this.markers[a].duration,this.durationMS=this.markers[a].durationMS,this._tempMarker=a,this._tempPosition=this.position,this._tempVolume=this.volume,this._tempLoop=this.loop}else this.position=b,this.volume=c,this.loop=d,this.duration=0,this.durationMS=0,this._tempMarker=a,this._tempPosition=b,this._tempVolume=c,this._tempLoop=d;this.usingWebAudio?this.game.cache.isSoundDecoded(this.key)?(null==this._buffer&&(this._buffer=this.game.cache.getSoundData(this.key)),this._sound=this.context.createBufferSource(),this._sound.buffer=this._buffer,this.externalNode?this._sound.connect(this.externalNode.input):this._sound.connect(this.gainNode),this.totalDuration=this._sound.buffer.duration,0===this.duration&&(this.duration=this.totalDuration,this.durationMS=1e3*this.totalDuration),this.loop&&""===a&&(this._sound.loop=!0),"undefined"==typeof this._sound.start?this._sound.noteGrainOn(0,this.position,this.duration):this._sound.start(0,this.position,this.duration),this.isPlaying=!0,this.startTime=this.game.time.now,this.currentTime=0,this.stopTime=this.startTime+this.durationMS,this.onPlay.dispatch(this)):(this.pendingPlayback=!0,this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).isDecoding===!1&&this.game.sound.decode(this.key,this)):this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).locked?(this.game.cache.reloadSound(this.key),this.pendingPlayback=!0):this._sound&&(this.game.device.cocoonJS||4===this._sound.readyState)?(this._sound.play(),this.totalDuration=this._sound.duration,0===this.duration&&(this.duration=this.totalDuration,this.durationMS=1e3*this.totalDuration),this._sound.currentTime=this.position,this._sound.muted=this._muted,this._sound.volume=this._muted?0:this._volume,this.isPlaying=!0,this.startTime=this.game.time.now,this.currentTime=0,this.stopTime=this.startTime+this.durationMS,this.onPlay.dispatch(this)):this.pendingPlayback=!0}},restart:function(a,b,c,d){a=a||"",b=b||0,c=c||1,"undefined"==typeof d&&(d=!1),this.play(a,b,c,d,!0)},pause:function(){this.isPlaying&&this._sound&&(this.stop(),this.isPlaying=!1,this.paused=!0,this.pausedPosition=this.currentTime,this.pausedTime=this.game.time.now,this.onPause.dispatch(this))},resume:function(){if(this.paused&&this._sound){if(this.usingWebAudio){var a=this.position+this.pausedPosition/1e3;this._sound=this.context.createBufferSource(),this._sound.buffer=this._buffer,this.externalNode?this._sound.connect(this.externalNode.input):this._sound.connect(this.gainNode),this.loop&&(this._sound.loop=!0),"undefined"==typeof this._sound.start?this._sound.noteGrainOn(0,a,this.duration):this._sound.start(0,a,this.duration)}else this._sound.play();this.isPlaying=!0,this.paused=!1,this.startTime+=this.game.time.now-this.pausedTime,this.onResume.dispatch(this)}},stop:function(){this.isPlaying&&this._sound&&(this.usingWebAudio?"undefined"==typeof this._sound.stop?this._sound.noteOff(0):this._sound.stop(0):this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0)),this.isPlaying=!1;var a=this.currentMarker;this.currentMarker="",this.onStop.dispatch(this,a)}},b.Sound.prototype.constructor=b.Sound,Object.defineProperty(b.Sound.prototype,"isDecoding",{get:function(){return this.game.cache.getSound(this.key).isDecoding}}),Object.defineProperty(b.Sound.prototype,"isDecoded",{get:function(){return this.game.cache.isSoundDecoded(this.key)}}),Object.defineProperty(b.Sound.prototype,"mute",{get:function(){return this._muted},set:function(a){a=a||null,a?(this._muted=!0,this.usingWebAudio?(this._muteVolume=this.gainNode.gain.value,this.gainNode.gain.value=0):this.usingAudioTag&&this._sound&&(this._muteVolume=this._sound.volume,this._sound.volume=0)):(this._muted=!1,this.usingWebAudio?this.gainNode.gain.value=this._muteVolume:this.usingAudioTag&&this._sound&&(this._sound.volume=this._muteVolume)),this.onMute.dispatch(this)}}),Object.defineProperty(b.Sound.prototype,"volume",{get:function(){return this._volume},set:function(a){this.usingWebAudio?(this._volume=a,this.gainNode.gain.value=a):this.usingAudioTag&&this._sound&&a>=0&&1>=a&&(this._volume=a,this._sound.volume=a)}}),b.SoundManager=function(a){this.game=a,this.onSoundDecode=new b.Signal,this._muted=!1,this._unlockSource=null,this._volume=1,this._sounds=[],this.context=null,this.usingWebAudio=!0,this.usingAudioTag=!1,this.noAudio=!1,this.connectToMaster=!0,this.touchLocked=!1,this.channels=32},b.SoundManager.prototype={boot:function(){if(this.game.device.iOS&&this.game.device.webAudio===!1&&(this.channels=1),this.game.device.iOS||window.PhaserGlobal&&window.PhaserGlobal.fakeiOSTouchLock?(this.game.input.touch.callbackContext=this,this.game.input.touch.touchStartCallback=this.unlock,this.game.input.mouse.callbackContext=this,this.game.input.mouse.mouseDownCallback=this.unlock,this.touchLocked=!0):this.touchLocked=!1,window.PhaserGlobal){if(window.PhaserGlobal.disableAudio===!0)return this.usingWebAudio=!1,this.noAudio=!0,void 0;if(window.PhaserGlobal.disableWebAudio===!0)return this.usingWebAudio=!1,this.usingAudioTag=!0,this.noAudio=!1,void 0}window.AudioContext?this.context=new window.AudioContext:window.webkitAudioContext?this.context=new window.webkitAudioContext:window.Audio?(this.usingWebAudio=!1,this.usingAudioTag=!0):(this.usingWebAudio=!1,this.noAudio=!0),null!==this.context&&(this.masterGain="undefined"==typeof this.context.createGain?this.context.createGainNode():this.context.createGain(),this.masterGain.gain.value=1,this.masterGain.connect(this.context.destination))},unlock:function(){if(this.touchLocked!==!1)if(this.game.device.webAudio===!1||window.PhaserGlobal&&window.PhaserGlobal.disableWebAudio===!0)this.touchLocked=!1,this._unlockSource=null,this.game.input.touch.callbackContext=null,this.game.input.touch.touchStartCallback=null,this.game.input.mouse.callbackContext=null,this.game.input.mouse.mouseDownCallback=null;else{var a=this.context.createBuffer(1,1,22050);this._unlockSource=this.context.createBufferSource(),this._unlockSource.buffer=a,this._unlockSource.connect(this.context.destination),this._unlockSource.noteOn(0)}},stopAll:function(){for(var a=0;a255)return b.Color.getColor(255,255,255);if(a>c)return b.Color.getColor(255,255,255);var e=a+Math.round(Math.random()*(c-a)),f=a+Math.round(Math.random()*(c-a)),g=a+Math.round(Math.random()*(c-a));return b.Color.getColor32(d,e,f,g)},getRGB:function(a){return{alpha:a>>>24,red:255&a>>16,green:255&a>>8,blue:255&a}},getWebRGB:function(a){var b=(a>>>24)/255,c=255&a>>16,d=255&a>>8,e=255&a;return"rgba("+c.toString()+","+d.toString()+","+e.toString()+","+b.toString()+")"},getAlpha:function(a){return a>>>24},getAlphaFloat:function(a){return(a>>>24)/255},getRed:function(a){return 255&a>>16},getGreen:function(a){return 255&a>>8},getBlue:function(a){return 255&a}},b.Physics={},b.Physics.LIME_CORONA_JSON=0,p2.Body.prototype.parent=null,b.Physics.World=function(a){this.game=a,this.onBodyAdded=new b.Signal,this.onBodyRemoved=new b.Signal,this.bounds=null,p2.World.call(this,{gravity:[0,0]}),this.on("addBody",this.addBodyHandler),this.on("removeBody",this.removeBodyHandler),this.on("postStep",this.postStepHandler),this.on("postBroadphase",this.postBroadphaseHandler),this.setBoundsToWorld(!0,!0,!0,!0)},b.Physics.World.prototype=Object.create(p2.World.prototype),b.Physics.World.prototype.constructor=b.Physics.World,b.Physics.World.prototype.addBodyHandler=function(a){a.body.parent&&this.onBodyAdded.dispatch(a.body.parent,a.target)},b.Physics.World.prototype.removeBodyHandler=function(a){a.body.parent&&this.onBodyRemoved.dispatch(a.body.parent,a.target)},b.Physics.World.prototype.postStepHandler=function(){},b.Physics.World.prototype.postBroadphaseHandler=function(a){for(var b=0;b=0;a--){var b=this.data.shapes[a];this.data.removeShape(b)}},addShape:function(a,b,c,d){return"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=0),"undefined"==typeof d&&(d=0),this.data.addShape(a,[this.px2p(b),this.px2p(c)],d),a},addCircle:function(a,b,c,d){var e=new p2.Circle(this.px2p(a));return this.addShape(e,b,c,d)},addRectangle:function(a,b,c,d,e){var f=new p2.Rectangle(this.px2p(a),this.px2p(b));return this.addShape(f,c,d,e)},addPlane:function(a,b,c,d,e){var f=new p2.Plane;return this.addShape(f,c,d,e)},addParticle:function(a,b,c,d,e){var f=new p2.Particle;return this.addShape(f,c,d,e)},addLine:function(a,b,c,d){var e=new p2.Line(this.px2p(a));return this.addShape(e,b,c,d)},addCapsule:function(a,b,c,d,e){var f=new p2.Capsule(this.px2p(a),b);return this.addShape(f,c,d,e)},addPolygon:function(a,b){a=a||{},b=Array.prototype.slice.call(arguments,1);var c=[];if(1===b.length&&Array.isArray(b[0]))c=c.concat(b[0]);else if(Array.isArray(b[0]))c=c.concat(b);else if("number"==typeof b[0])for(var d=0,e=b.length;e>d;d+=2)c.push([b[d],b[d+1]]);for(var f=0;ff;f+=2)e.push([d.shape[f],d.shape[f+1]]);return this.addPolygon(c,e)}return!1},loadData:function(a,b){var c=game.cache.getPhysicsData(a,b);c&&c.shape&&(this.mass=c.density,this.loadPolygon(a,b))},p2px:function(a){return a*=-20},px2p:function(a){return a*-.05}},b.Physics.Body.prototype.constructor=b.Physics.Body,Object.defineProperty(b.Physics.Body.prototype,"static",{get:function(){return this.data.motionState===b.STATIC},set:function(a){a&&this.data.motionState!==b.STATIC?this.data.motionState=b.STATIC:a||this.data.motionState!==b.STATIC||(this.data.motionState=b.DYNAMIC)}}),Object.defineProperty(b.Physics.Body.prototype,"dynamic",{get:function(){return this.data.motionState===b.DYNAMIC},set:function(a){a&&this.data.motionState!==b.DYNAMIC?this.data.motionState=b.DYNAMIC:a||this.data.motionState!==b.DYNAMIC||(this.data.motionState=b.STATIC)}}),Object.defineProperty(b.Physics.Body.prototype,"kinematic",{get:function(){return this.data.motionState===b.KINEMATIC},set:function(a){a&&this.data.motionState!==b.KINEMATIC?this.data.motionState=b.KINEMATIC:a||this.data.motionState!==b.KINEMATIC||(this.data.motionState=b.STATIC)}}),Object.defineProperty(b.Physics.Body.prototype,"allowSleep",{get:function(){return this.data.allowSleep},set:function(a){a!==this.data.allowSleep&&(this.data.allowSleep=a)}}),Object.defineProperty(b.Physics.Body.prototype,"angle",{get:function(){return b.Math.wrapAngle(b.Math.radToDeg(this.data.angle))},set:function(a){this.data.angle=b.Math.degToRad(b.Math.wrapAngle(a))}}),Object.defineProperty(b.Physics.Body.prototype,"angularDamping",{get:function(){return this.data.angularDamping},set:function(a){this.data.angularDamping=a}}),Object.defineProperty(b.Physics.Body.prototype,"angularForce",{get:function(){return this.data.angularForce},set:function(a){this.data.angularForce=a}}),Object.defineProperty(b.Physics.Body.prototype,"angularVelocity",{get:function(){return this.data.angularVelocity},set:function(a){this.data.angularVelocity=a}}),Object.defineProperty(b.Physics.Body.prototype,"damping",{get:function(){return this.data.damping},set:function(a){this.data.damping=a}}),Object.defineProperty(b.Physics.Body.prototype,"fixedRotation",{get:function(){return this.data.fixedRotation},set:function(a){a!==this.data.fixedRotation&&(this.data.fixedRotation=a)}}),Object.defineProperty(b.Physics.Body.prototype,"inertia",{get:function(){return this.data.inertia},set:function(a){this.data.inertia=a}}),Object.defineProperty(b.Physics.Body.prototype,"mass",{get:function(){return this.data.mass},set:function(a){a!==this.data.mass&&(this.data.mass=a,this.data.updateMassProperties())}}),Object.defineProperty(b.Physics.Body.prototype,"motionState",{get:function(){return this.data.motionState},set:function(a){a!==this.data.motionState&&(this.data.motionState=a)}}),Object.defineProperty(b.Physics.Body.prototype,"rotation",{get:function(){return this.data.angle},set:function(a){this.data.angle=a}}),Object.defineProperty(b.Physics.Body.prototype,"sleepSpeedLimit",{get:function(){return this.data.sleepSpeedLimit},set:function(a){this.data.sleepSpeedLimit=a}}),Object.defineProperty(b.Physics.Body.prototype,"x",{get:function(){return this.p2px(this.data.position[0])},set:function(a){this.data.position[0]=this.px2p(a)}}),Object.defineProperty(b.Physics.Body.prototype,"y",{get:function(){return this.p2px(this.data.position[1])},set:function(a){this.data.position[1]=this.px2p(a)}}),b.Physics.Spring=function(a,b,c,d,e,f,g,h,i,j){this.game=a,"undefined"==typeof d&&(d=1),"undefined"==typeof e&&(e=100),"undefined"==typeof f&&(f=1);var k={restLength:d,stiffness:e,damping:f};"undefined"!=typeof g&&null!==g&&(k.worldAnchorA=[a.math.px2p(g[0]),a.math.px2p(g[1])]),"undefined"!=typeof h&&null!==h&&(k.worldAnchorB=[a.math.px2p(h[0]),a.math.px2p(h[1])]),"undefined"!=typeof i&&null!==i&&(k.localAnchorA=[a.math.px2p(i[0]),a.math.px2p(i[1])]),"undefined"!=typeof j&&null!==j&&(k.localAnchorB=[a.math.px2p(j[0]),a.math.px2p(j[1])]),p2.Spring.call(this,b,c,k)},b.Physics.Spring.prototype=Object.create(p2.Spring.prototype),b.Physics.Spring.prototype.constructor=b.Physics.Spring,b.Particles=function(a){this.game=a,this.emitters={},this.ID=0},b.Particles.prototype={add:function(a){return this.emitters[a.name]=a,a},remove:function(a){delete this.emitters[a.name]},update:function(){for(var a in this.emitters)this.emitters[a].exists&&this.emitters[a].update()}},b.Particles.prototype.constructor=b.Particles,b.Particles.Arcade={},b.Particles.Arcade.Emitter=function(a,c,d,e){this.maxParticles=e||50,b.Group.call(this,a),this.name="emitter"+this.game.particles.ID++,this.type=b.EMITTER,this.x=0,this.y=0,this.width=1,this.height=1,this.minParticleSpeed=new b.Point(-100,-100),this.maxParticleSpeed=new b.Point(100,100),this.minParticleScale=1,this.maxParticleScale=1,this.minRotation=-360,this.maxRotation=360,this.gravity=100,this.particleClass=null,this.particleFriction=0,this.angularDrag=0,this.frequency=100,this.lifespan=2e3,this.bounce=new b.Point,this._quantity=0,this._timer=0,this._counter=0,this._explode=!0,this.on=!1,this.exists=!0,this.emitX=c,this.emitY=d},b.Particles.Arcade.Emitter.prototype=Object.create(b.Group.prototype),b.Particles.Arcade.Emitter.prototype.constructor=b.Particles.Arcade.Emitter,b.Particles.Arcade.Emitter.prototype.update=function(){if(this.on)if(this._explode){this._counter=0;do this.emitParticle(),this._counter++;while(this._counter=this._timer&&(this.emitParticle(),this._counter++,this._quantity>0&&this._counter>=this._quantity&&(this.on=!1),this._timer=this.game.time.now+this.frequency)},b.Particles.Arcade.Emitter.prototype.makeParticles=function(a,c,d,e,f){"undefined"==typeof c&&(c=0),"undefined"==typeof d&&(d=this.maxParticles),"undefined"==typeof e&&(e=!1),"undefined"==typeof f&&(f=!1);for(var g,h=0,i=a,j=c;d>h;)null===this.particleClass&&("object"==typeof a&&(i=this.game.rnd.pick(a)),"object"==typeof c&&(j=this.game.rnd.pick(c)),g=new b.Sprite(this.game,0,0,i,j)),e?(g.body.checkCollision.any=!0,g.body.checkCollision.none=!1):g.body.checkCollision.none=!0,g.body.collideWorldBounds=f,g.exists=!1,g.visible=!1,g.anchor.setTo(.5,.5),this.add(g),h++;return this},b.Particles.Arcade.Emitter.prototype.kill=function(){this.on=!1,this.alive=!1,this.exists=!1},b.Particles.Arcade.Emitter.prototype.revive=function(){this.alive=!0,this.exists=!0},b.Particles.Arcade.Emitter.prototype.start=function(a,b,c,d){"undefined"==typeof a&&(a=!0),"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=250),"undefined"==typeof d&&(d=0),this.revive(),this.visible=!0,this.on=!0,this._explode=a,this.lifespan=b,this.frequency=c,a?this._quantity=d:this._quantity+=d,this._counter=0,this._timer=this.game.time.now+c},b.Particles.Arcade.Emitter.prototype.emitParticle=function(){var a=this.getFirstExists(!1);if(null!=a){if(this.width>1||this.height>1?a.reset(this.game.rnd.integerInRange(this.left,this.right),this.game.rnd.integerInRange(this.top,this.bottom)):a.reset(this.emitX,this.emitY),a.lifespan=this.lifespan,a.body.bounce.setTo(this.bounce.x,this.bounce.y),a.body.velocity.x=this.minParticleSpeed.x!=this.maxParticleSpeed.x?this.game.rnd.integerInRange(this.minParticleSpeed.x,this.maxParticleSpeed.x):this.minParticleSpeed.x,a.body.velocity.y=this.minParticleSpeed.y!=this.maxParticleSpeed.y?this.game.rnd.integerInRange(this.minParticleSpeed.y,this.maxParticleSpeed.y):this.minParticleSpeed.y,a.body.gravity.y=this.gravity,a.body.angularVelocity=this.minRotation!=this.maxRotation?this.game.rnd.integerInRange(this.minRotation,this.maxRotation):this.minRotation,1!==this.minParticleScale||1!==this.maxParticleScale){var b=this.game.rnd.realInRange(this.minParticleScale,this.maxParticleScale);a.scale.setTo(b,b)}a.body.friction=this.particleFriction,a.body.angularDrag=this.angularDrag}},b.Particles.Arcade.Emitter.prototype.setSize=function(a,b){this.width=a,this.height=b},b.Particles.Arcade.Emitter.prototype.setXSpeed=function(a,b){a=a||0,b=b||0,this.minParticleSpeed.x=a,this.maxParticleSpeed.x=b},b.Particles.Arcade.Emitter.prototype.setYSpeed=function(a,b){a=a||0,b=b||0,this.minParticleSpeed.y=a,this.maxParticleSpeed.y=b},b.Particles.Arcade.Emitter.prototype.setRotation=function(a,b){a=a||0,b=b||0,this.minRotation=a,this.maxRotation=b},b.Particles.Arcade.Emitter.prototype.at=function(a){a.center&&(this.emitX=a.center.x,this.emitY=a.center.y)},Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"x",{get:function(){return this.emitX},set:function(a){this.emitX=a}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"y",{get:function(){return this.emitY},set:function(a){this.emitY=a}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"left",{get:function(){return Math.floor(this.x-this.width/2)}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"right",{get:function(){return Math.floor(this.x+this.width/2)}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"top",{get:function(){return Math.floor(this.y-this.height/2)}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"bottom",{get:function(){return Math.floor(this.y+this.height/2)}}),b.Tile=function(a,b,c,d,e,f){this.layer=a,this.index=b,this.x=c,this.y=d,this.width=e,this.height=f,this.alpha=1,this.properties={},this.scanned=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this.collides=!1,this.collideNone=!0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.collisionCallback=null,this.collisionCallbackContext=this},b.Tile.prototype={setCollisionCallback:function(a,b){this.collisionCallback=a,this.collisionCallbackContext=b},destroy:function(){this.collisionCallback=null,this.collisionCallbackContext=null,this.properties=null},setCollision:function(a,b,c,d){this.collideLeft=a,this.collideRight=b,this.collideUp=c,this.collideDown=d,this.collideNone=a||b||c||d?!1:!0},resetCollision:function(){this.collideNone=!0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1},copy:function(a){this.index=a.index,this.alpha=a.alpha,this.properties=a.properties,this.collides=a.collides,this.collideNone=a.collideNone,this.collideUp=a.collideUp,this.collideDown=a.collideDown,this.collideLeft=a.collideLeft,this.collideRight=a.collideRight,this.collisionCallback=a.collisionCallback,this.collisionCallbackContext=a.collisionCallbackContext}},b.Tile.prototype.constructor=b.Tile,Object.defineProperty(b.Tile.prototype,"canCollide",{get:function(){return this.collides||this.collisionCallback||this.layer.callbacks[this.index]}}),Object.defineProperty(b.Tile.prototype,"left",{get:function(){return this.x}}),Object.defineProperty(b.Tile.prototype,"right",{get:function(){return this.x+this.width}}),Object.defineProperty(b.Tile.prototype,"top",{get:function(){return this.y}}),Object.defineProperty(b.Tile.prototype,"bottom",{get:function(){return this.y+this.height}}),b.Tilemap=function(a,c){this.game=a,this.key=c;var d=b.TilemapParser.parse(this.game,c);null!==d&&(this.width=d.width,this.height=d.height,this.tileWidth=d.tileWidth,this.tileHeight=d.tileHeight,this.orientation=d.orientation,this.version=d.version,this.properties=d.properties,this.widthInPixels=d.widthInPixels,this.heightInPixels=d.heightInPixels,this.layers=d.layers,this.tilesets=d.tilesets,this.tiles=d.tiles,this.objects=d.objects,this.images=d.images,this.currentLayer=0,this.debugMap=[],this._results=[],this._tempA=0,this._tempB=0)},b.Tilemap.CSV=0,b.Tilemap.TILED_JSON=1,b.Tilemap.prototype={create:function(a,c,d){for(var e=[],f=0;d>f;f++){e[f]=[];for(var g=0;c>g;g++)e[f][g]=0}this.layers.push({name:a,width:c,height:d,alpha:1,visible:!0,tileMargin:0,tileSpacing:0,format:b.Tilemap.CSV,data:e,indexes:[],dirty:!0}),this.currentLayer=this.layers.length-1},addTilesetImage:function(a,b){if("undefined"==typeof b){if("string"!=typeof a)return!1;b=a}return"string"==typeof a&&(a=this.getTilesetIndex(a)),this.tilesets[a]?(this.tilesets[a].image=this.game.cache.getImage(b),!0):!1},createFromObjects:function(a,b,c,d,e,f,g){if("undefined"==typeof e&&(e=!0),"undefined"==typeof f&&(f=!0),"undefined"==typeof g&&(g=this.game.world),!this.objects[a])return console.warn("Tilemap.createFromObjects: Invalid objectgroup name given: "+a),void 0;for(var h,i=0,j=this.objects[a].length;j>i;i++)if(this.objects[a][i].gid===b){h=g.create(this.objects[a][i].x,this.objects[a][i].y,c,d,e),h.anchor.setTo(0,1),h.name=this.objects[a][i].name,h.visible=this.objects[a][i].visible,h.autoCull=f;for(property in this.objects[a][i].properties)g.set(h,property,this.objects[a][i].properties[property],!1,!1,0)}},createLayer:function(a,c,d,e){"undefined"==typeof c&&(c=this.game.width),"undefined"==typeof d&&(d=this.game.height),"undefined"==typeof e&&(e=this.game.world); -var f=a;return"string"==typeof a&&(f=this.getLayerIndex(a)),null===f||f>this.layers.length?(console.warn("Tilemap.createLayer: Invalid layer ID given: "+f),void 0):e.add(new b.TilemapLayer(this.game,this,f,c,d))},getIndex:function(a,b){for(var c=0;ce;e++)this.layers[d].callbacks[a[e]]={callback:b,callbackContext:c}},setTileLocationCallback:function(a,b,c,d,e,f,g){if(g=this.getLayer(g),this.copy(a,b,c,d,g),!(this._results.length<2))for(var h=1;hd;d++)this.setCollisionByIndex(a[d],b,c,!1);this.calculateFaces(c)},setCollisionBetween:function(a,b,c,d){if("undefined"==typeof c&&(c=!0),d=this.getLayer(d),!(a>b)){for(var e=a;b>=e;e++)this.setCollisionByIndex(e,c,d,!1);this.calculateFaces(d)}},setCollisionByExclusion:function(a,b,c){"undefined"==typeof b&&(b=!0),c=this.getLayer(c);for(var d=0,e=this.tiles.length;e>d;d++)-1===a.indexOf(d)&&this.setCollisionByIndex(d,b,c,!1);this.calculateFaces(c)},setCollisionByIndex:function(a,b,c,d){"undefined"==typeof b&&(b=!0),"undefined"==typeof c&&(c=this.currentLayer),"undefined"==typeof d&&(d=!0);for(var e=0;ef;f++)for(var h=0,i=this.layers[a].width;i>h;h++){var j=this.layers[a].data[f][h];j&&(b=this.getTileAbove(a,h,f),c=this.getTileBelow(a,h,f),d=this.getTileLeft(a,h,f),e=this.getTileRight(a,h,f),b&&b.collides&&(j.faceTop=!1),c&&c.collides&&(j.faceBottom=!1),d&&d.collides&&(j.faceLeft=!1),e&&e.collides&&(j.faceRight=!1))}},getTileAbove:function(a,b,c){return c>0?this.layers[a].data[c-1][b]:null},getTileBelow:function(a,b,c){return c0?this.layers[a].data[c][b-1]:null},getTileRight:function(a,b,c){return b=0&&c=0&&d=0&&a=0&&ba&&(a=0),0>b&&(b=0),c>this.layers[e].width&&(c=this.layers[e].width),d>this.layers[e].height&&(d=this.layers[e].height),this._results.length=0,this._results.push({x:a,y:b,width:c,height:d,layer:e});for(var f=b;b+d>f;f++)for(var g=a;a+c>g;g++)this._results.push(this.layers[e].data[f][g]);return this._results},paste:function(a,b,c,d){if("undefined"==typeof a&&(a=0),"undefined"==typeof b&&(b=0),d=this.getLayer(d),c&&!(c.length<2)){for(var e=c[1].x-a,f=c[1].y-b,g=1;g1?this.debugMap[this.layers[this.currentLayer].data[c][d]]?b.push("background: "+this.debugMap[this.layers[this.currentLayer].data[c][d]]):b.push("background: #ffffff"):b.push("background: rgb(0, 0, 0)");a+="\n"}b[0]=a,console.log.apply(console,b)},destroy:function(){this.removeAllLayers(),this.data=[],this.game=null}},b.Tilemap.prototype.constructor=b.Tilemap,b.TilemapLayer=function(c,d,e,f,g){this.game=c,this.map=d,this.index=e,this.layer=d.layers[e],this.canvas=b.Canvas.create(f,g),this.context=this.canvas.getContext("2d"),this.baseTexture=new a.BaseTexture(this.canvas),this.texture=new a.Texture(this.baseTexture),this.textureFrame=new b.Frame(0,0,0,f,g,"tilemapLayer",c.rnd.uuid()),b.Sprite.call(this,this.game,0,0,this.texture,this.textureFrame),this.name="",this.type=b.TILEMAPLAYER,this.fixedToCamera=!0,this.cameraOffset=new b.Point(0,0),this.tileColor="rgb(255, 255, 255)",this.debug=!1,this.debugAlpha=.5,this.debugColor="rgba(0, 255, 0, 1)",this.debugFill=!1,this.debugFillColor="rgba(0, 255, 0, 0.2)",this.debugCallbackColor="rgba(255, 0, 0, 1)",this.scrollFactorX=1,this.scrollFactorY=1,this.dirty=!0,this._cw=d.tileWidth,this._ch=d.tileHeight,this._ga=1,this._dx=0,this._dy=0,this._dw=0,this._dh=0,this._tx=0,this._ty=0,this._tw=0,this._th=0,this._tl=0,this._maxX=0,this._maxY=0,this._startX=0,this._startY=0,this._results=[],this._x=0,this._y=0,this._prevX=0,this._prevY=0,this.updateMax()},b.TilemapLayer.prototype=Object.create(b.Sprite.prototype),b.TilemapLayer.prototype=b.Utils.extend(!0,b.TilemapLayer.prototype,b.Sprite.prototype,a.Sprite.prototype),b.TilemapLayer.prototype.constructor=b.TilemapLayer,b.TilemapLayer.prototype.postUpdate=function(){b.Sprite.prototype.postUpdate.call(this),this.scrollX=this.game.camera.x*this.scrollFactorX,this.scrollY=this.game.camera.y*this.scrollFactorY,this.render()},b.TilemapLayer.prototype.resizeWorld=function(){this.game.world.setBounds(0,0,this.layer.widthInPixels,this.layer.heightInPixels)},b.TilemapLayer.prototype._fixX=function(a){return 0>a&&(a=0),1===this.scrollFactorX?a:this._x+(a-this._x/this.scrollFactorX)},b.TilemapLayer.prototype._unfixX=function(a){return 1===this.scrollFactorX?a:this._x/this.scrollFactorX+(a-this._x)},b.TilemapLayer.prototype._fixY=function(a){return 0>a&&(a=0),1===this.scrollFactorY?a:this._y+(a-this._y/this.scrollFactorY)},b.TilemapLayer.prototype._unfixY=function(a){return 1===this.scrollFactorY?a:this._y/this.scrollFactorY+(a-this._y)},b.TilemapLayer.prototype.getTileX=function(a){return this.game.math.snapToFloor(this._fixX(a),this.map.tileWidth)/this.map.tileWidth},b.TilemapLayer.prototype.getTileY=function(a){return this.game.math.snapToFloor(this._fixY(a),this.map.tileHeight)/this.map.tileHeight},b.TilemapLayer.prototype.getTileXY=function(a,b,c){return c.x=this.getTileX(a),c.y=this.getTileY(b),c},b.TilemapLayer.prototype.getTiles=function(a,b,c,d,e){"undefined"==typeof e&&(e=!1),a=this._fixX(a),b=this._fixY(b),c>this.layer.widthInPixels&&(c=this.layer.widthInPixels),d>this.layer.heightInPixels&&(d=this.layer.heightInPixels),this._tx=this.game.math.snapToFloor(a,this._cw)/this._cw,this._ty=this.game.math.snapToFloor(b,this._ch)/this._ch,this._tw=(this.game.math.snapToCeil(c,this._cw)+this._cw)/this._cw,this._th=(this.game.math.snapToCeil(d,this._ch)+this._ch)/this._ch,this._results.length=0;for(var f=this._ty;fthis.layer.width&&(this._maxX=this.layer.width),this._maxY>this.layer.height&&(this._maxY=this.layer.height)),this.dirty=!0},b.TilemapLayer.prototype.render=function(){if(this.layer.dirty&&(this.dirty=!0),this.dirty&&this.visible){this._prevX=this._dx,this._prevY=this._dy,this._dx=-(this._x-this._startX*this.map.tileWidth),this._dy=-(this._y-this._startY*this.map.tileHeight),this._tx=this._dx,this._ty=this._dy,this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.fillStyle=this.tileColor;var c,d;this.debug&&(this.context.globalAlpha=this.debugAlpha);for(var e=this._startY,f=this._startY+this._maxY;f>e;e++){this._column=this.layer.data[e];for(var g=this._startX,h=this._startX+this._maxX;h>g;g++)this._column[g]&&(c=this._column[g],this.map.tiles[c.index]&&(d=this.map.tilesets[this.map.tiles[c.index][2]],d.image?(this.debug===!1&&c.alpha!==this.context.globalAlpha&&(this.context.globalAlpha=c.alpha),d.tileWidth!==this.map.tileWidth||d.tileHeight!==this.map.tileHeight?this.context.drawImage(this.map.tilesets[this.map.tiles[c.index][2]].image,this.map.tiles[c.index][0],this.map.tiles[c.index][1],d.tileWidth,d.tileHeight,Math.floor(this._tx),Math.floor(this._ty)-(d.tileHeight-this.map.tileHeight),d.tileWidth,d.tileHeight):this.context.drawImage(this.map.tilesets[this.map.tiles[c.index][2]].image,this.map.tiles[c.index][0],this.map.tiles[c.index][1],this.map.tileWidth,this.map.tileHeight,Math.floor(this._tx),Math.floor(this._ty),this.map.tileWidth,this.map.tileHeight),c.debug&&(this.context.fillStyle="rgba(0, 255, 0, 0.4)",this.context.fillRect(Math.floor(this._tx),Math.floor(this._ty),this.map.tileWidth,this.map.tileHeight))):this.context.fillRect(Math.floor(this._tx),Math.floor(this._ty),this.map.tileWidth,this.map.tileHeight))),this._tx+=this.map.tileWidth;this._tx=this._dx,this._ty+=this.map.tileHeight}return this.debug&&(this.context.globalAlpha=1,this.renderDebug()),this.game.renderType===b.WEBGL&&a.texturesToUpdate.push(this.baseTexture),this.dirty=!1,this.layer.dirty=!1,!0}},b.TilemapLayer.prototype.renderDebug=function(){this._tx=this._dx,this._ty=this._dy,this.context.strokeStyle=this.debugColor,this.context.fillStyle=this.debugFillColor;for(var a=this._startY,b=this._startY+this._maxY;b>a;a++){this._column=this.layer.data[a];for(var c=this._startX,d=this._startX+this._maxX;d>c;c++){var e=this._column[c];e&&(e.faceTop||e.faceBottom||e.faceLeft||e.faceRight)&&(this._tx=Math.floor(this._tx),this.debugFill&&this.context.fillRect(this._tx,this._ty,this._cw,this._ch),this.context.beginPath(),e.faceTop&&(this.context.moveTo(this._tx,this._ty),this.context.lineTo(this._tx+this._cw,this._ty)),e.faceBottom&&(this.context.moveTo(this._tx,this._ty+this._ch),this.context.lineTo(this._tx+this._cw,this._ty+this._ch)),e.faceLeft&&(this.context.moveTo(this._tx,this._ty),this.context.lineTo(this._tx,this._ty+this._ch)),e.faceRight&&(this.context.moveTo(this._tx+this._cw,this._ty),this.context.lineTo(this._tx+this._cw,this._ty+this._ch)),this.context.stroke()),e&&(e.collisionCallback||e.layer.callbacks[e.index])&&(this.context.fillStyle=this.debugCallbackColor,this.context.fillRect(this._tx,this._ty,this._cw,this._ch),this.context.fillStyle=this.debugFillColor),this._tx+=this.map.tileWidth}this._tx=this._dx,this._ty+=this.map.tileHeight}},Object.defineProperty(b.TilemapLayer.prototype,"scrollX",{get:function(){return this._x},set:function(a){a!==this._x&&a>=0&&this.layer.widthInPixels>this.width&&(this._x=a,this._x>this.layer.widthInPixels-this.width&&(this._x=this.layer.widthInPixels-this.width),this._startX=this.game.math.floor(this._x/this.map.tileWidth),this._startX<0&&(this._startX=0),this._startX+this._maxX>this.layer.width&&(this._startX=this.layer.width-this._maxX),this.dirty=!0)}}),Object.defineProperty(b.TilemapLayer.prototype,"scrollY",{get:function(){return this._y},set:function(a){a!==this._y&&a>=0&&this.layer.heightInPixels>this.height&&(this._y=a,this._y>this.layer.heightInPixels-this.height&&(this._y=this.layer.heightInPixels-this.height),this._startY=this.game.math.floor(this._y/this.map.tileHeight),this._startY<0&&(this._startY=0),this._startY+this._maxY>this.layer.height&&(this._startY=this.layer.height-this._maxY),this.dirty=!0)}}),Object.defineProperty(b.TilemapLayer.prototype,"collisionWidth",{get:function(){return this._cw},set:function(a){this._cw=a,this.dirty=!0}}),Object.defineProperty(b.TilemapLayer.prototype,"collisionHeight",{get:function(){return this._ch},set:function(a){this._ch=a,this.dirty=!0}}),b.TilemapParser={tileset:function(a,c,d,e,f,g,h,i,j){var k=a.cache.getTilesetImage(c);if(null===k)return console.warn("Phaser.TilemapParser.tileSet: Invalid image key given"),null;var l=k.width,m=k.height;return-1===h&&(h=Math.round(l/d)),-1===i&&(i=Math.round(m/e)),-1===j&&(j=h*i),0===l||0===m||d>l||e>m||0===j?(console.warn("Phaser.TilemapParser.tileSet: width/height zero or width/height < given tileWidth/tileHeight"),null):new b.Tileset(k,c,d,e,f,g,h,i,j)},parse:function(a,c){var d=a.cache.getTilemapData(c);return d?d.format===b.Tilemap.CSV?this.parseCSV(d.data):d.format===b.Tilemap.TILED_JSON?this.parseTiledJSON(d.data):void 0:{layers:[],objects:[],images:[],tilesets:[]}},parseCSV:function(a){a=a.trim();for(var b=[],c=a.split("\n"),d=c.length,e=0,f=0;fj;j++)a.layers[e].data[j]>0?h.push(new b.Tile(f,a.layers[e].data[j],g,i.length,a.tilewidth,a.tileheight)):h.push(null),g++,g===a.layers[e].width&&(i.push(h),g=0,h=[]);f.data=i,d.push(f)}c.layers=d;for(var l=[],e=0;eo;o++)if(a.layers[e].objects[o].gid){var p={gid:a.layers[e].objects[o].gid,name:a.layers[e].objects[o].name,x:a.layers[e].objects[o].x,y:a.layers[e].objects[o].y,visible:a.layers[e].objects[o].visible,properties:a.layers[e].objects[o].properties};n[a.layers[e].name].push(p)}}c.objects=n;for(var q=[],e=0;e0&&(e=1/Math.sqrt(e),a[0]=b[0]*e,a[1]=b[1]*e),a},d.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]},d.cross=function(a,b,c){var d=b[0]*c[1]-b[1]*c[0];return a[0]=a[1]=0,a[2]=d,a},d.lerp=function(a,b,c,d){var e=b[0],f=b[1];return a[0]=e+d*(c[0]-e),a[1]=f+d*(c[1]-f),a},d.transformMat2=function(a,b,c){var d=b[0],e=b[1];return a[0]=d*c[0]+e*c[1],a[1]=d*c[2]+e*c[3],a},d.forEach=function(){var a=new Float32Array(2);return function(b,c,d,e,f,g){var h,i;for(c||(c=2),d||(d=0),i=e?Math.min(e*c+d,b.length):b.length,h=d;i>h;h+=c)a[0]=b[h],a[1]=b[h+1],f(a,a,g),b[h]=a[0],b[h+1]=a[1];return b}}(),d.str=function(a){return"vec2("+a[0]+", "+a[1]+")"},"undefined"!=typeof c&&(c.vec2=d)},{}],3:[function(a,b){function c(){}var d=a("./Scalar");b.exports=c,c.lineInt=function(a,b,c){c=c||0;var e,f,g,h,i,j,k,l=[0,0];return e=a[1][1]-a[0][1],f=a[0][0]-a[1][0],g=e*a[0][0]+f*a[0][1],h=b[1][1]-b[0][1],i=b[0][0]-b[1][0],j=h*b[0][0]+i*b[0][1],k=e*i-h*f,d.eq(k,0,c)||(l[0]=(i*g-f*j)/k,l[1]=(e*j-h*g)/k),l},c.segmentsIntersect=function(a,b,c,d){var e=b[0]-a[0],f=b[1]-a[1],g=d[0]-c[0],h=d[1]-c[1];if(0==g*f-h*e)return!1;var i=(e*(c[1]-a[1])+f*(a[0]-c[0]))/(g*f-h*e),j=(g*(a[1]-c[1])+h*(c[0]-a[0]))/(h*e-g*f);return i>=0&&1>=i&&j>=0&&1>=j}},{"./Scalar":6}],4:[function(a,b){function c(){}b.exports=c,c.area=function(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1])},c.left=function(a,b,d){return c.area(a,b,d)>0},c.leftOn=function(a,b,d){return c.area(a,b,d)>=0},c.right=function(a,b,d){return c.area(a,b,d)<0},c.rightOn=function(a,b,d){return c.area(a,b,d)<=0};var d=[],e=[];c.collinear=function(a,b,f,g){if(g){var h=d,i=e;h[0]=b[0]-a[0],h[1]=b[1]-a[1],i[0]=f[0]-b[0],i[1]=f[1]-b[1];var j=h[0]*i[0]+h[1]*i[1],k=Math.sqrt(h[0]*h[0]+h[1]*h[1]),l=Math.sqrt(i[0]*i[0]+i[1]*i[1]),m=Math.acos(j/(k*l));return g>m}return 0==c.area(a,b,f)},c.sqdist=function(a,b){var c=b[0]-a[0],d=b[1]-a[1];return c*c+d*d}},{}],5:[function(a,b){function c(){this.vertices=[]}function d(a,b,c,d,e){e=e||0;var f=b[1]-a[1],h=a[0]-b[0],i=f*a[0]+h*a[1],j=d[1]-c[1],k=c[0]-d[0],l=j*c[0]+k*c[1],m=f*k-j*h;return g.eq(m,0,e)?[0,0]:[(k*i-h*l)/m,(f*l-j*i)/m]}var e=a("./Line"),f=a("./Point"),g=a("./Scalar");b.exports=c,c.prototype.at=function(a){var b=this.vertices,c=b.length;return b[0>a?a%c+c:a%c]},c.prototype.first=function(){return this.vertices[0]},c.prototype.last=function(){return this.vertices[this.vertices.length-1]},c.prototype.clear=function(){this.vertices.length=0},c.prototype.append=function(a,b,c){if("undefined"==typeof b)throw new Error("From is not given!");if("undefined"==typeof c)throw new Error("To is not given!");if(b>c-1)throw new Error("lol1");if(c>a.vertices.length)throw new Error("lol2");if(0>b)throw new Error("lol3");for(var d=b;c>d;d++)this.vertices.push(a.vertices[d])},c.prototype.makeCCW=function(){for(var a=0,b=this.vertices,c=1;cb[a][0])&&(a=c);f.left(this.at(a-1),this.at(a),this.at(a+1))||this.reverse()},c.prototype.reverse=function(){for(var a=[],b=0,c=this.vertices.length;b!==c;b++)a.push(this.vertices.pop());this.vertices=a},c.prototype.isReflex=function(a){return f.right(this.at(a-1),this.at(a),this.at(a+1))};var h=[],i=[];c.prototype.canSee=function(a,b){var c,d,g=h,j=i;if(f.leftOn(this.at(a+1),this.at(a),this.at(b))&&f.rightOn(this.at(a-1),this.at(a),this.at(b)))return!1;d=f.sqdist(this.at(a),this.at(b));for(var k=0;k!==this.vertices.length;++k)if((k+1)%this.vertices.length!==a&&k!==a&&f.leftOn(this.at(a),this.at(b),this.at(k+1))&&f.rightOn(this.at(a),this.at(b),this.at(k))&&(g[0]=this.at(a),g[1]=this.at(b),j[0]=this.at(k),j[1]=this.at(k+1),c=e.lineInt(g,j),f.sqdist(this.at(a),c)a)for(var f=a;b>=f;f++)e.vertices.push(this.vertices[f]);else{for(var f=0;b>=f;f++)e.vertices.push(this.vertices[f]);for(var f=a;f0?this.slice(a):[this]},c.prototype.slice=function(a){if(0==a.length)return[this];if(a instanceof Array&&a.length&&a[0]instanceof Array&&2==a[0].length&&a[0][0]instanceof Array){for(var b=[this],c=0;cc;c++)if(e.segmentsIntersect(a[b],a[b+1],a[c],a[c+1]))return!1;for(var b=1;bh)return console.warn("quickDecomp: max level ("+h+") reached."),a;for(var x=0;xo&&(n=o,k=l,r=y))),f.left(v.at(x+1),v.at(x),v.at(y+1))&&f.rightOn(v.at(x+1),v.at(x),v.at(y))&&(l=d(v.at(x+1),v.at(x),v.at(y),v.at(y+1)),f.left(v.at(x-1),v.at(x),l)&&(o=f.sqdist(v.vertices[x],l),m>o&&(m=o,j=l,q=y)));if(r==(q+1)%this.vertices.length)l[0]=(k[0]+j[0])/2,l[1]=(k[1]+j[1])/2,e.push(l),q>x?(t.append(v,x,q+1),t.vertices.push(l),u.vertices.push(l),0!=r&&u.append(v,r,v.vertices.length),u.append(v,0,x+1)):(0!=x&&t.append(v,x,v.vertices.length),t.append(v,0,q+1),t.vertices.push(l),u.vertices.push(l),u.append(v,r,x+1));else{if(r>q&&(q+=this.vertices.length),p=Number.MAX_VALUE,r>q)return a;for(var y=r;q>=y;++y)f.leftOn(v.at(x-1),v.at(x),v.at(y))&&f.rightOn(v.at(x+1),v.at(x),v.at(y))&&(o=f.sqdist(v.at(x),v.at(y)),p>o&&(p=o,s=y%this.vertices.length));s>x?(t.append(v,x,s+1),0!=s&&u.append(v,s,w.length),u.append(v,0,x+1)):(0!=x&&t.append(v,x,w.length),t.append(v,0,s+1),u.append(v,s,x+1))}return t.vertices.length3&&c>=0;--c)f.collinear(this.at(c-1),this.at(c),this.at(c+1),a)&&(this.vertices.splice(c%this.vertices.length,1),c--,b++);return b}},{"./Line":3,"./Point":4,"./Scalar":6}],6:[function(a,b){function c(){}b.exports=c,c.eq=function(a,b,c){return c=c||0,Math.abs(a-b) (http://steffe.se)",keywords:["p2.js","p2","physics","engine","2d"],main:"./src/p2.js",engines:{node:"*"},repository:{type:"git",url:"https://github.com/schteppe/p2.js.git"},bugs:{url:"https://github.com/schteppe/p2.js/issues"},licenses:[{type:"MIT"}],devDependencies:{jshint:"latest",nodeunit:"latest",grunt:"~0.4.0","grunt-contrib-jshint":"~0.1.1","grunt-contrib-nodeunit":"~0.1.2","grunt-contrib-concat":"~0.1.3","grunt-contrib-uglify":"*","grunt-browserify":"*",browserify:"*"},dependencies:{underscore:"*","poly-decomp":"git://github.com/schteppe/poly-decomp.js","gl-matrix":"2.0.0",jsonschema:"*"}}},{}],9:[function(a,b){function c(a){this.lowerBound=d.create(),a&&a.lowerBound&&d.copy(this.lowerBound,a.lowerBound),this.upperBound=d.create(),a&&a.upperBound&&d.copy(this.upperBound,a.upperBound)}var d=a("../math/vec2");a("../utils/Utils"),b.exports=c;var e=d.create();c.prototype.setFromPoints=function(a,b,c){var f=this.lowerBound,g=this.upperBound;d.set(f,Number.MAX_VALUE,Number.MAX_VALUE),d.set(g,-Number.MAX_VALUE,-Number.MAX_VALUE);for(var h=0;hj;j++)i[j]>g[j]&&(g[j]=i[j]),i[j]b;b++)a.lowerBound[b]this.upperBound[b]&&(this.upperBound[b]=a.upperBound[b])},c.prototype.overlaps=function(a){var b=this.lowerBound,c=this.upperBound,d=a.lowerBound,e=a.upperBound;return(d[0]<=c[0]&&c[0]<=e[0]||b[0]<=e[0]&&e[0]<=c[0])&&(d[1]<=c[1]&&c[1]<=e[1]||b[1]<=e[1]&&e[1]<=c[1])}},{"../math/vec2":33,"../utils/Utils":49}],10:[function(a,b){function c(){this.result=[],this.world=null}var d=a("../math/vec2"),e=a("../objects/Body");b.exports=c,c.prototype.setWorld=function(a){this.world=a},c.prototype.getCollisionPairs=function(){throw new Error("getCollisionPairs must be implemented in a subclass!")};var f=d.create();c.boundingRadiusCheck=function(a,b){d.sub(f,a.position,b.position);var c=d.squaredLength(f),e=a.boundingRadius+b.boundingRadius;return e*e>=c},c.aabbCheck=function(a,b){return a.aabbNeedsUpdate&&a.updateAABB(),b.aabbNeedsUpdate&&b.updateAABB(),a.aabb.overlaps(b.aabb)},c.canCollide=function(a,b){return a.motionState&e.STATIC&&b.motionState&e.STATIC?!1:a.sleepState&e.SLEEPING&&b.sleepState&e.SLEEPING?!1:!0}},{"../math/vec2":33,"../objects/Body":34}],11:[function(a,b){function d(a,b,c,d,e,f){h.apply(this),e=e||10,f=f||10,this.binsizeX=(b-a)/e,this.binsizeY=(d-c)/f,this.nx=e,this.ny=f,this.xmin=a,this.ymin=c,this.xmax=b,this.ymax=d}var e=a("../shapes/Circle"),f=a("../shapes/Plane"),g=a("../shapes/Particle"),h=a("../collision/Broadphase");a("../math/vec2"),b.exports=d,d.prototype=new h,d.prototype.getBinIndex=function(a,b){var c=this.nx,d=this.ny,e=this.xmin,f=this.ymin,g=this.xmax,h=this.ymax,i=Math.floor(c*(a-e)/(g-e)),j=Math.floor(d*(b-f)/(h-f));return i*d+j},d.prototype.getCollisionPairs=function(a){for(var b=[],d=a.bodies,i=i=d.length,j=this.binsizeX,k=this.binsizeY,l=[],m=nx*ny,n=0;m>n;n++)l.push([]);for(var o=nx/(xmax-xmin),p=ny/(ymax-ymin),n=0;n!==i;n++){var q=d[n],r=q.shape;if(void 0!==r)if(r instanceof e)for(var s=q.position[0],t=q.position[1],u=r.radius,v=Math.floor(o*(s-u-xmin)),w=Math.floor(p*(t-u-ymin)),x=Math.floor(o*(s+u-xmin)),y=Math.floor(p*(t+u-ymin)),z=v;x>=z;z++)for(var A=w;y>=A;A++){var B=z,C=A;B*(ny-1)+C>=0&&m>B*(ny-1)+C&&l[B*(ny-1)+C].push(q)}else{if(!(r instanceof f))throw new Error("Shape not supported in GridBroadphase!");if(0==q.angle)for(var t=q.position[1],z=0;z!==m&&t>ymin+k*(z-1);z++)for(var A=0;nx>A;A++){var B=A,C=Math.floor(p*(k*z-ymin));l[B*(ny-1)+C].push(q)}else if(q.angle==.5*Math.PI)for(var s=q.position[0],z=0;z!==m&&s>xmin+j*(z-1);z++)for(var A=0;ny>A;A++){var C=A,B=Math.floor(o*(j*z-xmin));l[B*(ny-1)+C].push(q)}else for(var z=0;z!==m;z++)l[z].push(q)}}for(var n=0;n!==m;n++)for(var D=l[n],z=0,E=D.length;z!==E;z++)for(var q=D[z],r=q.shape,A=0;A!==z;A++){var F=D[A],G=F.shape;r instanceof e?G instanceof e?c=h.circleCircle(q,F):G instanceof g?c=h.circleParticle(q,F):G instanceof f&&(c=h.circlePlane(q,F)):r instanceof g?G instanceof e&&(c=h.circleParticle(F,q)):r instanceof f&&G instanceof e&&(c=h.circlePlane(F,q))}return b}},{"../collision/Broadphase":10,"../math/vec2":33,"../shapes/Circle":38,"../shapes/Particle":41,"../shapes/Plane":42}],12:[function(a,b){function c(){d.apply(this),this.useBoundingBoxes=!1}var d=(a("../shapes/Circle"),a("../shapes/Plane"),a("../shapes/Shape"),a("../shapes/Particle"),a("../collision/Broadphase"));a("../math/vec2"),b.exports=c,c.prototype=new d,c.prototype.getCollisionPairs=function(a){var b,c,e,f,g=a.bodies,h=this.result,i=this.useBoundingBoxes?d.aabbCheck:d.boundingRadiusCheck;for(h.length=0,b=0,Ncolliding=g.length;b!==Ncolliding;b++)for(e=g[b],c=0;b>c;c++)f=g[c],d.canCollide(e,f)&&i(e,f)&&h.push(e,f);return h}},{"../collision/Broadphase":10,"../math/vec2":33,"../shapes/Circle":38,"../shapes/Particle":41,"../shapes/Plane":42,"../shapes/Shape":44}],13:[function(a,b){function c(){this.contactEquations=[],this.frictionEquations=[],this.enableFriction=!0,this.slipForce=10,this.frictionCoefficient=.3,this.surfaceVelocity=0,this.reuseObjects=!0,this.reusableContactEquations=[],this.reusableFrictionEquations=[],this.restitution=0,this.collidingBodiesLastStep={keys:[]}}function d(a){for(var b=0,c=a.keys.length;c>b;b++)delete a[a.keys[b]];a.keys.length=0}function e(a,b,c,d){for(var e=J,i=K,j=L,k=M,l=a,m=b.vertices,n=null,o=0;o!==m.length+1;o++){var p=m[o%m.length],q=m[(o+1)%m.length];f.rotate(e,p,d),f.rotate(i,q,d),h(e,e,c),h(i,i,c),g(j,e,l),g(k,i,l);var r=f.crossLength(j,k);if(null===n&&(n=r),0>=r*n)return!1;n=r}return!0}var f=a("../math/vec2"),g=f.sub,h=f.add,i=f.dot,j=a("../utils/Utils"),k=a("../equations/ContactEquation"),l=a("../equations/FrictionEquation"),m=a("../shapes/Circle"),n=a("../shapes/Shape"),o=a("../objects/Body");b.exports=c;var p=f.fromValues(0,1),q=f.fromValues(0,0),r=f.fromValues(0,0),s=f.fromValues(0,0),t=f.fromValues(0,0),u=f.fromValues(0,0),v=f.fromValues(0,0),w=f.fromValues(0,0),x=f.fromValues(0,0),y=f.fromValues(0,0),z=f.fromValues(0,0),A=f.fromValues(0,0),B=f.fromValues(0,0),C=f.fromValues(0,0),D=f.fromValues(0,0),E=f.fromValues(0,0),F=f.fromValues(0,0),G=f.fromValues(0,0),H=f.fromValues(0,0),I=[];c.prototype.collidedLastStep=function(a,b){var c=a.id,d=b.id;if(c>d){var e=c;c=d,d=e}return!!this.collidingBodiesLastStep[c+" "+d]},c.prototype.reset=function(){d(this.collidingBodiesLastStep);for(var a=0;a!==this.contactEquations.length;a++){var b=this.contactEquations[a],c=b.bi.id,e=b.bj.id;if(c>e){var f=c;c=e,e=f}var g=c+" "+e;this.collidingBodiesLastStep[g]||(this.collidingBodiesLastStep[g]=!0,this.collidingBodiesLastStep.keys.push(g))}if(this.reuseObjects){var h=this.contactEquations,i=this.frictionEquations,k=this.reusableFrictionEquations,l=this.reusableContactEquations;j.appendArray(l,h),j.appendArray(k,i)}this.contactEquations.length=this.frictionEquations.length=0},c.prototype.createContactEquation=function(a,b,c,d){var e=this.reusableContactEquations.length?this.reusableContactEquations.pop():new k(a,b);return e.bi=a,e.bj=b,e.shapeA=c,e.shapeB=d,e.restitution=this.restitution,e.firstImpact=!this.collidedLastStep(a,b),a.allowSleep&&a.motionState&o.DYNAMIC&&!(b.motionState&o.STATIC||b.sleepState===o.SLEEPY)&&a.wakeUp(),b.allowSleep&&b.motionState&o.DYNAMIC&&!(a.motionState&o.STATIC||a.sleepState===o.SLEEPY)&&b.wakeUp(),e},c.prototype.createFrictionEquation=function(a,b,c,d){var e=this.reusableFrictionEquations.length?this.reusableFrictionEquations.pop():new l(a,b);return e.bi=a,e.bj=b,e.shapeA=c,e.shapeB=d,e.setSlipForce(this.slipForce),e.frictionCoefficient=this.frictionCoefficient,e.relativeVelocity=this.surfaceVelocity,e},c.prototype.createFrictionFromContact=function(a){var b=this.createFrictionEquation(a.bi,a.bj,a.shapeA,a.shapeB);return f.copy(b.ri,a.ri),f.copy(b.rj,a.rj),f.rotate(b.t,a.ni,-Math.PI/2),b.contactEquation=a,b},c.prototype[n.LINE|n.CONVEX]=c.prototype.convexLine=function(){return 0},c.prototype[n.LINE|n.RECTANGLE]=c.prototype.lineRectangle=function(){return 0},c.prototype[n.CAPSULE|n.RECTANGLE]=c.prototype.rectangleCapsule=function(){return 0},c.prototype[n.CAPSULE|n.CONVEX]=c.prototype.convexCapsule=function(){return 0},c.prototype[n.CAPSULE|n.LINE]=c.prototype.lineCapsule=function(){return 0},c.prototype[n.CAPSULE|n.CAPSULE]=c.prototype.capsuleCapsule=function(){return 0},c.prototype[n.LINE|n.LINE]=c.prototype.lineLine=function(){return 0},c.prototype[n.PLANE|n.LINE]=c.prototype.planeLine=function(a,b,c,d,e,j,k,l){var m=q,n=r,o=s,z=t,A=u,B=v,C=w,D=x,E=y,F=I;numContacts=0,f.set(m,-j.length/2,0),f.set(n,j.length/2,0),f.rotate(o,m,l),f.rotate(z,n,l),h(o,o,k),h(z,z,k),f.copy(m,o),f.copy(n,z),g(A,n,m),f.normalize(B,A),f.rotate(E,B,-Math.PI/2),f.rotate(D,p,d),F[0]=m,F[1]=n;for(var G=0;GJ){var K=this.createContactEquation(a,e,b,j);numContacts++,f.copy(K.ni,D),f.normalize(K.ni,K.ni),f.scale(C,D,J),g(K.ri,H,C),g(K.ri,K.ri,a.position),g(K.rj,H,k),h(K.rj,K.rj,k),g(K.rj,K.rj,e.position),this.contactEquations.push(K),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(K))}}return numContacts},c.prototype[n.PARTICLE|n.CAPSULE]=c.prototype.particleCapsule=function(a,b,c,d,e,f,g,h,i){return this.circleLine(a,b,c,d,e,f,g,h,i,f.radius,0)},c.prototype[n.CIRCLE|n.LINE]=c.prototype.circleLine=function(a,b,c,d,e,j,k,l,m,n,o){var p=j,E=l,F=e,G=k,H=c,J=a,K=b,n=n||0,o="undefined"!=typeof o?o:K.radius,L=q,M=r,N=s,O=t,P=u,Q=v,R=w,S=x,T=y,U=z,V=A,W=B,X=C,Y=D,Z=I;f.set(S,-p.length/2,0),f.set(T,p.length/2,0),f.rotate(U,S,E),f.rotate(V,T,E),h(U,U,G),h(V,V,G),f.copy(S,U),f.copy(T,V),g(Q,T,S),f.normalize(R,Q),f.rotate(P,R,-Math.PI/2),g(W,H,S);var $=i(W,P);if(g(O,S,G),g(X,H,G),Math.abs($)ab&&bb>_){if(m)return 1;var cb=this.createContactEquation(J,F,b,j);return f.scale(cb.ni,L,-1),f.normalize(cb.ni,cb.ni),f.scale(cb.ri,cb.ni,o),h(cb.ri,cb.ri,H),g(cb.ri,cb.ri,J.position),g(cb.rj,N,G),h(cb.rj,cb.rj,G),g(cb.rj,cb.rj,F.position),this.contactEquations.push(cb),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(cb)),1}}Z[0]=S,Z[1]=T;for(var db=0;dbW&&(f.copy(Q,O),S=W,f.scale(N,K,W),f.add(N,N,O),R=!0)}}if(R){var X=this.createContactEquation(y,v,b,j);return f.sub(X.ni,Q,x),f.normalize(X.ni,X.ni),f.scale(X.ri,X.ni,n),h(X.ri,X.ri,x),g(X.ri,X.ri,y.position),g(X.rj,N,w),h(X.rj,X.rj,w),g(X.rj,X.rj,v.position),this.contactEquations.push(X),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(X)),1}if(n>0)for(var T=0;TV&&(P=V,f.scale(M,I,V),f.add(M,M,y),f.copy(O,I),Q=!0)}if(Q){var W=this.createContactEquation(A,p,b,k);return f.scale(W.ni,O,-1),f.normalize(W.ni,W.ni),f.set(W.ri,0,0),h(W.ri,W.ri,y),g(W.ri,W.ri,A.position),g(W.rj,M,x),h(W.rj,W.rj,x),g(W.rj,W.rj,p.position),this.contactEquations.push(W),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(W)),1}return 0},c.prototype[n.CIRCLE]=c.prototype.circleCircle=function(a,b,c,d,e,i,j,k,l){var m=a,n=b,o=c,p=e,r=i,s=j,t=q;g(t,c,j);var u=b.radius+i.radius;if(f.squaredLength(t)>u*u)return 0;if(l)return 1;var v=this.createContactEquation(m,p,b,i);return g(v.ni,s,o),f.normalize(v.ni,v.ni),f.scale(v.ri,v.ni,n.radius),f.scale(v.rj,v.ni,-r.radius),h(v.ri,v.ri,o),g(v.ri,v.ri,m.position),h(v.rj,v.rj,s),g(v.rj,v.rj,p.position),this.contactEquations.push(v),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(v)),1},c.prototype[n.PLANE|n.CONVEX]=c.prototype.planeConvex=function(a,b,c,d,e,j,k,l){var m=e,n=k,o=j,t=l,u=a,v=b,w=c,x=d,y=q,z=r,A=s,B=0;f.rotate(z,p,x);for(var C=0;C=2)break}}return B},c.prototype.convexPlane=function(a,b,c,d,e,f,g,h){return console.warn("Narrowphase.prototype.convexPlane is deprecated. Use planeConvex instead!"),this.planeConvex(e,f,g,h,a,b,c,d)},c.prototype[n.PARTICLE|n.PLANE]=c.prototype.particlePlane=function(a,b,c,d,e,h,j,k,l){var m=a,n=c,o=e,s=j,t=k,u=q,v=r;t=t||0,g(u,n,s),f.rotate(v,p,t);var w=i(u,v);if(w>0)return 0;if(l)return 1;var x=this.createContactEquation(o,m,h,b);return f.copy(x.ni,v),f.scale(u,x.ni,w),g(x.ri,n,u),g(x.ri,x.ri,o.position),g(x.rj,n,m.position),this.contactEquations.push(x),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(x)),1},c.prototype[n.CIRCLE|n.PARTICLE]=c.prototype.circleParticle=function(a,b,c,d,e,i,j,k,l){var m=a,n=b,o=c,p=e,r=j,s=q;if(g(s,r,o),f.squaredLength(s)>n.radius*n.radius)return 0;if(l)return 1;var t=this.createContactEquation(m,p,b,i);return f.copy(t.ni,s),f.normalize(t.ni,t.ni),f.scale(t.ri,t.ni,n.radius),h(t.ri,t.ri,o),g(t.ri,t.ri,m.position),g(t.rj,r,p.position),this.contactEquations.push(t),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(t)),1};{var N=new m(1),O=f.create(),P=f.create();f.create()}c.prototype[n.PLANE|n.CAPSULE]=c.prototype.planeCapsule=function(a,b,c,d,e,g,i,j){var k=O,l=P,m=N;f.set(k,-g.length/2,0),f.rotate(k,k,j),h(k,k,i),f.set(l,g.length/2,0),f.rotate(l,l,j),h(l,l,i),m.radius=g.radius;var n=this.circlePlane(e,m,k,0,a,b,c,d),o=this.circlePlane(e,m,l,0,a,b,c,d);return n+o},c.prototype.capsulePlane=function(a,b,c,d,e,f,g,h){return console.warn("Narrowphase.prototype.capsulePlane() is deprecated. Use .planeCapsule() instead!"),this.planeCapsule(e,f,g,h,a,b,c,d)},c.prototype[n.CIRCLE|n.PLANE]=c.prototype.circlePlane=function(a,b,c,d,e,j,k,l){var m=a,n=b,o=c,t=e,u=k,v=l;v=v||0;var w=q,x=r,y=s;g(w,o,u),f.rotate(x,p,v);var z=i(x,w);if(z>n.radius)return 0;var A=this.createContactEquation(t,m,j,b);return f.copy(A.ni,x),f.scale(A.rj,A.ni,-n.radius),h(A.rj,A.rj,o),g(A.rj,A.rj,m.position),f.scale(y,A.ni,z),g(A.ri,w,y),h(A.ri,A.ri,u),g(A.ri,A.ri,t.position),this.contactEquations.push(A),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(A)),1},c.prototype[n.CONVEX]=c.prototype.convexConvex=function(a,b,d,e,j,k,l,m,n){var o=q,p=r,v=s,z=t,A=u,B=w,C=x,D=y,E=0,n=n||1e-10,F=c.findSeparatingAxis(b,d,e,k,l,m,o);if(!F)return 0;g(C,l,d),i(o,C)>0&&f.scale(o,o,-1);var G=c.getClosestEdge(b,e,o,!0),H=c.getClosestEdge(k,m,o);if(-1==G||-1==H)return 0;for(var I=0;2>I;I++){var J=G,K=H,L=b,M=k,N=d,O=l,P=e,Q=m,R=a,S=j;if(0==I){var T;T=J,J=K,K=T,T=L,L=M,M=T,T=N,N=O,O=T,T=P,P=Q,Q=T,T=R,R=S,S=T}for(var U=K;K+2>U;U++){var V=M.vertices[(U+M.vertices.length)%M.vertices.length];f.rotate(p,V,Q),h(p,p,O);for(var W=0,X=J-1;J+2>X;X++){var Y=L.vertices[(X+L.vertices.length)%L.vertices.length],Z=L.vertices[(X+1+L.vertices.length)%L.vertices.length];f.rotate(v,Y,P),f.rotate(z,Z,P),h(v,v,N),h(z,z,N),g(A,z,v),f.rotate(D,A,-Math.PI/2),f.normalize(D,D),g(C,p,v);var $=i(D,C);n>=$&&W++}if(3==W){var _=this.createContactEquation(R,S,L,M);E++;var Y=L.vertices[J%L.vertices.length],Z=L.vertices[(J+1)%L.vertices.length];f.rotate(v,Y,P),f.rotate(z,Z,P),h(v,v,N),h(z,z,N),g(A,z,v),f.rotate(_.ni,A,-Math.PI/2),f.normalize(_.ni,_.ni),g(C,p,v);var $=i(_.ni,C);f.scale(B,_.ni,$),g(_.ri,p,N),g(_.ri,_.ri,B),h(_.ri,_.ri,N),g(_.ri,_.ri,R.position),g(_.rj,p,O),h(_.rj,_.rj,O),g(_.rj,_.rj,S.position),this.contactEquations.push(_),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(_))}}}return E};var Q=f.fromValues(0,0);c.projectConvexOntoAxis=function(a,b,c,d,e){var g,h,j=null,k=null,l=Q;f.rotate(l,d,-c);for(var m=0;mj)&&(j=h),(null===k||k>h)&&(k=h);if(k>j){var n=k;k=j,j=n}var o=i(b,d);f.set(e,k+o,j+o)};var R=f.fromValues(0,0),S=f.fromValues(0,0),T=f.fromValues(0,0),U=f.fromValues(0,0),V=f.fromValues(0,0),W=f.fromValues(0,0);c.findSeparatingAxis=function(a,b,d,e,h,i,j){for(var k=null,l=!1,m=!1,n=R,o=S,p=T,q=U,r=V,s=W,t=0;2!==t;t++){var u=a,v=d;1===t&&(u=e,v=i);for(var w=0;w!==u.vertices.length;w++){f.rotate(o,u.vertices[w],v),f.rotate(p,u.vertices[(w+1)%u.vertices.length],v),g(n,p,o),f.rotate(q,n,-Math.PI/2),f.normalize(q,q),c.projectConvexOntoAxis(a,b,d,q,r),c.projectConvexOntoAxis(e,h,i,q,s);var x=r,y=s,z=!1;r[0]>s[0]&&(y=r,x=s,z=!0);var A=y[0]-x[1];l=0>A,(null===k||A>k)&&(f.copy(j,q),k=A,m=l)}}return m};var X=f.fromValues(0,0),Y=f.fromValues(0,0),Z=f.fromValues(0,0);c.getClosestEdge=function(a,b,c,d){var e=X,h=Y,j=Z;f.rotate(e,c,-b),d&&f.scale(e,e,-1);for(var k=-1,l=a.vertices.length,m=Math.PI/2,n=0;n!==l;n++){g(h,a.vertices[(n+1)%l],a.vertices[n%l]),f.rotate(j,h,-m),f.normalize(j,j);var o=i(j,e);(-1==k||o>maxDot)&&(k=n%l,maxDot=o)}return k}},{"../equations/ContactEquation":23,"../equations/FrictionEquation":25,"../math/vec2":33,"../objects/Body":34,"../shapes/Circle":38,"../shapes/Shape":44,"../utils/Utils":49}],14:[function(a,b){function c(a,b,c,f){var g;g=b?new d(a,0,c,f):new e(a,0,c,f),this.root=g}function d(a,b,c,d){this.bounds=a,this.children=[],this.nodes=[],d&&(this.maxChildren=d),c&&(this.maxDepth=c),b&&(this.depth=b)}function e(a,b,c,e){d.call(this,a,b,c,e),this.stuckChildren=[]}var f=a("../shapes/Plane"),g=a("../collision/Broadphase");b.exports={QuadTree:c,Node:d,BoundsNode:e},c.prototype.insert=function(a){if(a instanceof Array)for(var b=a.length,c=0;b>c;c++)this.root.insert(a[c]);else this.root.insert(a)},c.prototype.clear=function(){this.root.clear()},c.prototype.retrieve=function(a){var b=this.root.retrieve(a).slice(0);return b},c.prototype.getCollisionPairs=function(a){var b=[];this.insert(a.bodies);for(var c=0;c!==a.bodies.length;c++)for(var d=a.bodies[c],e=this.retrieve(d),f=0,h=e.length;f!==h;f++){var i=e[f];if(d!==i){for(var j=!1,k=0,l=b.length;l>k;k+=2){var m=b[k],n=b[k+1];if(m==i&&n==d||n==i&&m==d){j=!0;break}}!j&&g.boundingRadiusCheck(d,i)&&b.push(d,i)}}return this.clear(),b},d.prototype.classConstructor=d,d.prototype.children=null,d.prototype.depth=0,d.prototype.maxChildren=4,d.prototype.maxDepth=4,d.TOP_LEFT=0,d.TOP_RIGHT=1,d.BOTTOM_LEFT=2,d.BOTTOM_RIGHT=3,d.prototype.insert=function(a){if(this.nodes.length){var b=this.findIndex(a);return this.nodes[b].insert(a),void 0}this.children.push(a);var c=this.children.length;if(!(this.depth>=this.maxDepth)&&c>this.maxChildren){this.subdivide();for(var d=0;c>d;d++)this.insert(this.children[d]);this.children.length=0}},d.prototype.retrieve=function(a){if(this.nodes.length){var b=this.findIndex(a);return this.nodes[b].retrieve(a)}return this.children},d.prototype.findIndex=function(a){var b=this.bounds,c=a.position[0]-a.boundingRadius>b.x+b.width/2?!1:!0,e=a.position[1]-a.boundingRadius>b.y+b.height/2?!1:!0; +a instanceof f&&(c=e=!1);var g=d.TOP_LEFT;return c?e||(g=d.BOTTOM_LEFT):g=e?d.TOP_RIGHT:d.BOTTOM_RIGHT,g},d.prototype.subdivide=function(){var a=this.depth+1,b=this.bounds.x,c=this.bounds.y,e=this.bounds.width/2,f=this.bounds.height/2,g=b+e,h=c+f;this.nodes[d.TOP_LEFT]=new this.classConstructor({x:b,y:c,width:e,height:f},a),this.nodes[d.TOP_RIGHT]=new this.classConstructor({x:g,y:c,width:e,height:f},a),this.nodes[d.BOTTOM_LEFT]=new this.classConstructor({x:b,y:h,width:e,height:f},a),this.nodes[d.BOTTOM_RIGHT]=new this.classConstructor({x:g,y:h,width:e,height:f},a)},d.prototype.clear=function(){this.children.length=0;for(var a=this.nodes.length,b=0;a>b;b++)this.nodes[b].clear();this.nodes.length=0},e.prototype=new d,e.prototype.classConstructor=e,e.prototype.stuckChildren=null,e.prototype.out=[],e.prototype.insert=function(a){if(this.nodes.length){var b=this.findIndex(a),c=this.nodes[b];return!(a instanceof f)&&a.position[0]-a.boundingRadius>=c.bounds.x&&a.position[0]+a.boundingRadius<=c.bounds.x+c.bounds.width&&a.position[1]-a.boundingRadius>=c.bounds.y&&a.position[1]+a.boundingRadius<=c.bounds.y+c.bounds.height?this.nodes[b].insert(a):this.stuckChildren.push(a),void 0}this.children.push(a);var d=this.children.length;if(this.depththis.maxChildren){this.subdivide();for(var e=0;d>e;e++)this.insert(this.children[e]);this.children.length=0}},e.prototype.getChildren=function(){return this.children.concat(this.stuckChildren)},e.prototype.retrieve=function(a){var b=this.out;if(b.length=0,this.nodes.length){var c=this.findIndex(a);b.push.apply(b,this.nodes[c].retrieve(a))}return b.push.apply(b,this.stuckChildren),b.push.apply(b,this.children),b},e.prototype.clear=function(){this.stuckChildren.length=0,this.children.length=0;var a=this.nodes.length;if(a){for(var b=0;a>b;b++)this.nodes[b].clear();this.nodes.length=0}}},{"../collision/Broadphase":10,"../shapes/Plane":42}],15:[function(a,b){function c(){e.apply(this),this.axisListX=[],this.axisListY=[],this.world=null;var a=this.axisListX,b=this.axisListY;this._addBodyHandler=function(c){a.push(c.body),b.push(c.body)},this._removeBodyHandler=function(c){var d=a.indexOf(c.body);-1!==d&&a.splice(d,1),d=b.indexOf(c.body),-1!==d&&b.splice(d,1)}}var d=(a("../shapes/Circle"),a("../shapes/Plane"),a("../shapes/Shape"),a("../shapes/Particle"),a("../utils/Utils")),e=a("../collision/Broadphase");a("../math/vec2"),b.exports=c,c.prototype=new e,c.prototype.setWorld=function(a){this.axisListX.length=this.axisListY.length=0,d.appendArray(this.axisListX,a.bodies),d.appendArray(this.axisListY,a.bodies),a.off("addBody",this._addBodyHandler).off("removeBody",this._removeBodyHandler),a.on("addBody",this._addBodyHandler).on("removeBody",this._removeBodyHandler),this.world=a},c.sortAxisListX=function(a){for(var b=1,c=a.length;c>b;b++){for(var d=a[b],e=b-1;e>=0&&!(a[e].aabb.lowerBound[0]<=d.aabb.lowerBound[0]);e--)a[e+1]=a[e];a[e+1]=d}return a},c.sortAxisListY=function(a){for(var b=1,c=a.length;c>b;b++){for(var d=a[b],e=b-1;e>=0&&!(a[e].aabb.lowerBound[1]<=d.aabb.lowerBound[1]);e--)a[e+1]=a[e];a[e+1]=d}return a};var f={keys:[]};c.prototype.getCollisionPairs=function(){var a,b,d=this.axisListX,g=this.axisListY,h=this.result;for(this.axisIndex,h.length=0,a=0;a!==d.length;a++){var i=d[a];i.aabbNeedsUpdate&&i.updateAABB()}for(c.sortAxisListX(d),c.sortAxisListY(g),a=0,N=d.length;a!==N;a++){var j=d[a];for(b=a+1;N>b;b++){var k=d[b];if(!c.checkBounds(j,k,0))break;var l=j.idb;b++){var k=g[b];if(!c.checkBounds(j,k,1))break;var l=j.idc)g.scale(e.ni,i,-1),g.sub(e.ri,j,h.position),g.sub(e.rj,k,o.position),g.scale(n,i,c),g.add(e.ri,e.ri,n),-1==a.indexOf(e)&&a.push(e);else{var u=a.indexOf(e);-1!=u&&a.splice(u,1)}if(this.lowerLimitEnabled&&d>s)g.scale(f.ni,i,1),g.sub(f.ri,j,h.position),g.sub(f.rj,k,o.position),g.scale(n,i,d),g.sub(f.rj,f.rj,n),-1==a.indexOf(f)&&a.push(f);else{var u=a.indexOf(f);-1!=u&&a.splice(u,1)}},c.prototype.enableMotor=function(){this.motorEnabled||(this.equations.push(this.motorEquation),this.motorEnabled=!0)},c.prototype.disableMotor=function(){if(this.motorEnabled){var a=this.equations.indexOf(this.motorEquation);this.equations.splice(a,1),this.motorEnabled=!1}}},{"../equations/ContactEquation":23,"../equations/Equation":24,"../equations/RotationalLockEquation":26,"../math/vec2":33,"./Constraint":16}],21:[function(a,b){function c(a,b,c,n,o){d.call(this,a,c),o=this.maxForce="undefined"!=typeof o?o:Number.MAX_VALUE,this.pivotA=b,this.pivotB=n;var p=this.equations=[new e(a,c,-o,o),new e(a,c,-o,o)],q=p[0],r=p[1];q.computeGq=function(){return h.rotate(i,b,a.angle),h.rotate(j,n,c.angle),h.add(m,c.position,j),h.sub(m,m,a.position),h.sub(m,m,i),h.dot(m,k)},r.computeGq=function(){return h.rotate(i,b,a.angle),h.rotate(j,n,c.angle),h.add(m,c.position,j),h.sub(m,m,a.position),h.sub(m,m,i),h.dot(m,l)},r.minForce=q.minForce=-o,r.maxForce=q.maxForce=o,this.motorEquation=new f(a,c),this.motorEnabled=!1,this.angle=0,this.lowerLimitEnabled=!1,this.upperLimitEnabled=!1,this.lowerLimit=0,this.upperLimit=0,this.upperLimitEquation=new g(a,c),this.lowerLimitEquation=new g(a,c),this.upperLimitEquation.minForce=0,this.lowerLimitEquation.maxForce=0}var d=a("./Constraint"),e=a("../equations/Equation"),f=a("../equations/RotationalVelocityEquation"),g=a("../equations/RotationalLockEquation"),h=a("../math/vec2");b.exports=c;var i=h.create(),j=h.create(),k=h.fromValues(1,0),l=h.fromValues(0,1),m=h.create();c.prototype=new d,c.prototype.update=function(){var a=this.bodyA,b=this.bodyB,c=this.pivotA,d=this.pivotB,e=this.equations,f=(e[0],e[1],e[0]),g=e[1],m=this.upperLimit,n=this.lowerLimit,o=this.upperLimitEquation,p=this.lowerLimitEquation,q=this.angle=b.angle-a.angle;if(this.upperLimitEnabled&&q>m)o.angle=m,-1==e.indexOf(o)&&e.push(o);else{var r=e.indexOf(o);-1!=r&&e.splice(r,1)}if(this.lowerLimitEnabled&&n>q)p.angle=n,-1==e.indexOf(p)&&e.push(p);else{var r=e.indexOf(p);-1!=r&&e.splice(r,1)}h.rotate(i,c,a.angle),h.rotate(j,d,b.angle),f.G[0]=-1,f.G[1]=0,f.G[2]=-h.crossLength(i,k),f.G[3]=1,f.G[4]=0,f.G[5]=h.crossLength(j,k),g.G[0]=0,g.G[1]=-1,g.G[2]=-h.crossLength(i,l),g.G[3]=0,g.G[4]=1,g.G[5]=h.crossLength(j,l)},c.prototype.enableMotor=function(){this.motorEnabled||(this.equations.push(this.motorEquation),this.motorEnabled=!0)},c.prototype.disableMotor=function(){if(this.motorEnabled){var a=this.equations.indexOf(this.motorEquation);this.equations.splice(a,1),this.motorEnabled=!1}},c.prototype.motorIsEnabled=function(){return!!this.motorEnabled},c.prototype.setMotorSpeed=function(a){if(this.motorEnabled){var b=this.equations.indexOf(this.motorEquation);this.equations[b].relativeVelocity=a}},c.prototype.getMotorSpeed=function(){return this.motorEnabled?this.motorEquation.relativeVelocity:!1}},{"../equations/Equation":24,"../equations/RotationalLockEquation":26,"../equations/RotationalVelocityEquation":27,"../math/vec2":33,"./Constraint":16}],22:[function(a,b){function c(a,b,c){c=c||{},d.call(this,a,b,-Number.MAX_VALUE,Number.MAX_VALUE),this.angle=c.angle||0,this.ratio="number"==typeof c.ratio?c.ratio:1,this.setRatio(this.ratio)}var d=a("./Equation");a("../math/vec2"),b.exports=c,c.prototype=new d,c.prototype.constructor=c,c.prototype.computeGq=function(){return this.ratio*this.bi.angle-this.bj.angle+this.angle},c.prototype.setRatio=function(a){var b=this.G;b[2]=a,b[5]=-1,this.ratio=a}},{"../math/vec2":33,"./Equation":24}],23:[function(a,b){function c(a,b){d.call(this,a,b,0,Number.MAX_VALUE),this.ri=e.create(),this.penetrationVec=e.create(),this.rj=e.create(),this.ni=e.create(),this.restitution=0,this.firstImpact=!1,this.shapeA=null,this.shapeB=null}var d=a("./Equation"),e=a("../math/vec2");a("../math/mat2"),b.exports=c,c.prototype=new d,c.prototype.constructor=c,c.prototype.computeB=function(a,b,c){var d=this.bi,f=this.bj,g=this.ri,h=this.rj,i=d.position,j=f.position,k=this.penetrationVec,l=this.ni,m=this.G,n=e.crossLength(g,l),o=e.crossLength(h,l);m[0]=-l[0],m[1]=-l[1],m[2]=-n,m[3]=l[0],m[4]=l[1],m[5]=o,e.add(k,j,h),e.sub(k,k,i),e.sub(k,k,g);var p,q;this.firstImpact&&0!==this.restitution?(q=0,p=1/b*(1+this.restitution)*this.computeGW()):(p=this.computeGW(),q=e.dot(l,k));var r=this.computeGiMf(),s=-q*a-p*b-c*r;return s}},{"../math/mat2":31,"../math/vec2":33,"./Equation":24}],24:[function(a,b){function c(a,b,c,d){this.minForce="undefined"==typeof c?-1e6:c,this.maxForce="undefined"==typeof d?1e6:d,this.bi=a,this.bj=b,this.stiffness=1e6,this.relaxation=4,this.G=new g.ARRAY_TYPE(6),this.offset=0,this.a=0,this.b=0,this.eps=0,this.h=0,this.updateSpookParams(1/60),this.multiplier=0,this.relativeVelocity=0}function d(a,b,c,d,e){return a[0]*b[0]+a[1]*b[1]+a[2]*c+a[3]*d[0]+a[4]*d[1]+a[5]*e}b.exports=c;var e=a("../math/vec2"),f=a("../math/mat2"),g=a("../utils/Utils");c.prototype.constructor=c,c.prototype.updateSpookParams=function(a){var b=this.stiffness,c=this.relaxation,d=a;this.a=4/(d*(1+4*c)),this.b=4*c/(1+4*c),this.eps=4/(d*d*b*(1+4*c)),this.h=a},c.prototype.computeB=function(a,b,c){var d=this.computeGW(),e=this.computeGq(),f=this.computeGiMf();return-e*a-d*b-f*c};var h=e.create(),i=e.create();c.prototype.computeGq=function(){var a=this.G,b=this.bi,c=this.bj,e=(b.position,c.position,b.angle),f=c.angle;return d(a,h,e,i,f)+this.offset},e.create(),e.create(),c.prototype.transformedGmult=function(a,b,c,e,f){return d(a,b,c,e,f)},c.prototype.computeGW=function(){var a=this.G,b=this.bi,c=this.bj,d=b.velocity,e=c.velocity,f=b.angularVelocity,g=c.angularVelocity;return this.transformedGmult(a,d,f,e,g)+this.relativeVelocity},c.prototype.computeGWlambda=function(){var a=this.G,b=this.bi,c=this.bj,e=b.vlambda,f=c.vlambda,g=b.wlambda,h=c.wlambda;return d(a,e,g,f,h)};var j=e.create(),k=e.create();c.prototype.computeGiMf=function(){var a=this.bi,b=this.bj,c=a.force,d=a.angularForce,f=b.force,g=b.angularForce,h=a.invMass,i=b.invMass,l=a.invInertia,m=b.invInertia,n=this.G;return e.scale(j,c,h),e.scale(k,f,i),this.transformedGmult(n,j,d*l,k,g*m)},c.prototype.computeGiMGt=function(){var a=this.bi,b=this.bj,c=a.invMass,d=b.invMass,e=a.invInertia,f=b.invInertia,g=this.G;return g[0]*g[0]*c+g[1]*g[1]*c+g[2]*g[2]*e+g[3]*g[3]*d+g[4]*g[4]*d+g[5]*g[5]*f};{var l=e.create(),m=e.create(),n=e.create();e.create(),e.create(),e.create(),f.create(),f.create()}c.prototype.addToWlambda=function(a){var b=this.bi,c=this.bj,d=l,f=m,g=n,h=this.G;f[0]=h[0],f[1]=h[1],g[0]=h[3],g[1]=h[4],e.scale(d,f,b.invMass*a),e.add(b.vlambda,b.vlambda,d),e.scale(d,g,c.invMass*a),e.add(c.vlambda,c.vlambda,d),b.wlambda+=b.invInertia*h[2]*a,c.wlambda+=c.invInertia*h[5]*a},c.prototype.computeInvC=function(a){return 1/(this.computeGiMGt()+a)}},{"../math/mat2":31,"../math/vec2":33,"../utils/Utils":49}],25:[function(a,b){function c(a,b,c){e.call(this,a,b,-c,c),this.ri=d.create(),this.rj=d.create(),this.t=d.create(),this.contactEquation=null,this.shapeA=null,this.shapeB=null,this.frictionCoefficient=.3}var d=(a("../math/mat2"),a("../math/vec2")),e=a("./Equation");a("../utils/Utils"),b.exports=c,c.prototype=new e,c.prototype.constructor=c,c.prototype.setSlipForce=function(a){this.maxForce=a,this.minForce=-a},c.prototype.computeB=function(a,b,c){var e=(this.bi,this.bj,this.ri),f=this.rj,g=this.t,h=this.G;h[0]=-g[0],h[1]=-g[1],h[2]=-d.crossLength(e,g),h[3]=g[0],h[4]=g[1],h[5]=d.crossLength(f,g);var i=this.computeGW(),j=this.computeGiMf(),k=-i*b-c*j;return k}},{"../math/mat2":31,"../math/vec2":33,"../utils/Utils":49,"./Equation":24}],26:[function(a,b){function c(a,b,c){c=c||{},d.call(this,a,b,-Number.MAX_VALUE,Number.MAX_VALUE),this.angle=c.angle||0;var e=this.G;e[2]=1,e[5]=-1}var d=a("./Equation"),e=a("../math/vec2");b.exports=c,c.prototype=new d,c.prototype.constructor=c;var f=e.create(),g=e.create(),h=e.fromValues(1,0),i=e.fromValues(0,1);c.prototype.computeGq=function(){return e.rotate(f,h,this.bi.angle+this.angle),e.rotate(g,i,this.bj.angle),e.dot(f,g)}},{"../math/vec2":33,"./Equation":24}],27:[function(a,b){function c(a,b){d.call(this,a,b,-Number.MAX_VALUE,Number.MAX_VALUE),this.relativeVelocity=1,this.ratio=1}var d=a("./Equation");a("../math/vec2"),b.exports=c,c.prototype=new d,c.prototype.constructor=c,c.prototype.computeB=function(a,b,c){var d=this.G;d[2]=-1,d[5]=this.ratio;var e=this.computeGiMf(),f=this.computeGW(),g=-f*b-c*e;return g}},{"../math/vec2":33,"./Equation":24}],28:[function(a,b){var c=function(){};b.exports=c,c.prototype={constructor:c,on:function(a,b,c){b.context=c||this,void 0===this._listeners&&(this._listeners={});var d=this._listeners;return void 0===d[a]&&(d[a]=[]),-1===d[a].indexOf(b)&&d[a].push(b),this},has:function(a,b){if(void 0===this._listeners)return!1;var c=this._listeners;return void 0!==c[a]&&-1!==c[a].indexOf(b)?!0:!1},off:function(a,b){if(void 0===this._listeners)return this;var c=this._listeners,d=c[a].indexOf(b);return-1!==d&&c[a].splice(d,1),this},emit:function(a){if(void 0===this._listeners)return this;var b=this._listeners,c=b[a.type];if(void 0!==c){a.target=this;for(var d=0,e=c.length;e>d;d++){var f=c[d];f.call(f.context,a)}}return this}}},{}],29:[function(a,b){function c(a,b,c){c=c||{},this.id=d++,this.materialA=a,this.materialB=b,this.friction="undefined"!=typeof c.friction?Number(c.friction):.3,this.restitution="undefined"!=typeof c.restitution?Number(c.restitution):0,this.stiffness="undefined"!=typeof c.stiffness?Number(c.stiffness):1e7,this.relaxation="undefined"!=typeof c.relaxation?Number(c.relaxation):3,this.frictionStiffness="undefined"!=typeof c.frictionStiffness?Number(c.frictionStiffness):1e7,this.frictionRelaxation="undefined"!=typeof c.frictionRelaxation?Number(c.frictionRelaxation):3,this.surfaceVelocity="undefined"!=typeof c.surfaceVelocity?Number(c.surfaceVelocity):0}b.exports=c;var d=0},{}],30:[function(a,b){function c(){this.id=d++}b.exports=c;var d=0},{}],31:[function(a,b){var c=a("../../node_modules/gl-matrix/src/gl-matrix/mat2").mat2;b.exports=c},{"../../node_modules/gl-matrix/src/gl-matrix/mat2":1}],32:[function(a,b){var c={};c.GetArea=function(a){if(a.length<6)return 0;for(var b=a.length-2,c=0,d=0;b>d;d+=2)c+=(a[d+2]-a[d])*(a[d+1]+a[d+3]);return c+=(a[0]-a[b])*(a[b+1]+a[1]),.5*-c},c.Triangulate=function(a){var b=a.length>>1;if(3>b)return[];for(var d=[],e=[],f=0;b>f;f++)e.push(f);for(var f=0,g=b;g>3;){var h=e[(f+0)%g],i=e[(f+1)%g],j=e[(f+2)%g],k=a[2*h],l=a[2*h+1],m=a[2*i],n=a[2*i+1],o=a[2*j],p=a[2*j+1],q=!1;if(c._convex(k,l,m,n,o,p)){q=!0;for(var r=0;g>r;r++){var s=e[r];if(s!=h&&s!=i&&s!=j&&c._PointInTriangle(a[2*s],a[2*s+1],k,l,m,n,o,p)){q=!1;break}}}if(q)d.push(h,i,j),e.splice((f+1)%g,1),g--,f=0;else if(f++>3*g)break}return d.push(e[0],e[1],e[2]),d},c._PointInTriangle=function(a,b,c,d,e,f,g,h){var i=g-c,j=h-d,k=e-c,l=f-d,m=a-c,n=b-d,o=i*i+j*j,p=i*k+j*l,q=i*m+j*n,r=k*k+l*l,s=k*m+l*n,t=1/(o*r-p*p),u=(r*q-p*s)*t,v=(o*s-p*q)*t;return u>=0&&v>=0&&1>u+v},c._convex=function(a,b,c,d,e,f){return(b-d)*(e-c)+(c-a)*(f-d)>=0},b.exports=c},{}],33:[function(a,b){var c=a("../../node_modules/gl-matrix/src/gl-matrix/vec2").vec2;c.getX=function(a){return a[0]},c.getY=function(a){return a[1]},c.crossLength=function(a,b){return a[0]*b[1]-a[1]*b[0]},c.crossVZ=function(a,b,d){return c.rotate(a,b,-Math.PI/2),c.scale(a,a,d),a},c.crossZV=function(a,b,d){return c.rotate(a,d,Math.PI/2),c.scale(a,a,b),a},c.rotate=function(a,b,c){var d=Math.cos(c),e=Math.sin(c),f=b[0],g=b[1];a[0]=d*f-e*g,a[1]=e*f+d*g},c.toLocalFrame=function(a,b,d,e){c.copy(a,b),c.sub(a,a,d),c.rotate(a,a,-e)},c.toGlobalFrame=function(a,b,d,e){c.copy(a,b),c.rotate(a,a,e),c.add(a,a,d)},c.centroid=function(a,b,d,e){return c.add(a,b,d),c.add(a,a,e),c.scale(a,a,1/3),a},b.exports=c},{"../../node_modules/gl-matrix/src/gl-matrix/vec2":2}],34:[function(a,b){function c(a){a=a||{},h.call(this),this.id=++c._idCounter,this.world=null,this.shapes=[],this.shapeOffsets=[],this.shapeAngles=[],this.mass=a.mass||0,this.invMass=0,this.inertia=0,this.invInertia=0,this.fixedRotation=!!a.fixedRotation||!1,this.updateMassProperties(),this.position=d.fromValues(0,0),a.position&&d.copy(this.position,a.position),this.interpolatedPosition=d.fromValues(0,0),this.velocity=d.fromValues(0,0),a.velocity&&d.copy(this.velocity,a.velocity),this.vlambda=d.fromValues(0,0),this.wlambda=0,this.angle=a.angle||0,this.angularVelocity=a.angularVelocity||0,this.force=d.create(),a.force&&d.copy(this.force,a.force),this.angularForce=a.angularForce||0,this.damping="number"==typeof a.damping?a.damping:.1,this.angularDamping="number"==typeof a.angularDamping?a.angularDamping:.1,this.motionState=0==this.mass?c.STATIC:c.DYNAMIC,this.boundingRadius=0,this.aabb=new g,this.aabbNeedsUpdate=!0,this.allowSleep=!1,this.sleepState=c.AWAKE,this.sleepSpeedLimit=.1,this.sleepTimeLimit=1,this.timeLastSleepy=0,this.concavePath=null,this.lastDampingScale=1,this.lastAngularDampingScale=1,this.lastDampingTimeStep=-1}var d=a("../math/vec2"),e=a("poly-decomp"),f=a("../shapes/Convex"),g=a("../collision/AABB"),h=a("../events/EventEmitter");b.exports=c,c.prototype=new h,c._idCounter=0,c.prototype.setDensity=function(a){var b=this.getArea();this.mass=b*a,this.updateMassProperties()},c.prototype.getArea=function(){for(var a=0,b=0;be&&(e=h+i)}this.boundingRadius=e},c.prototype.addShape=function(a,b,c){c=c||0,b=b?d.fromValues(b[0],b[1]):d.fromValues(0,0),this.shapes.push(a),this.shapeOffsets.push(b),this.shapeAngles.push(c),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0},c.prototype.removeShape=function(a){var b=this.shapes.indexOf(a);return-1!=b?(this.shapes.splice(b,1),this.shapeOffsets.splice(b,1),this.shapeAngles.splice(b,1),this.aabbNeedsUpdate=!0,!0):!1},c.prototype.updateMassProperties=function(){var a=this.shapes,b=a.length,c=this.mass/b,e=0;if(!this.fixedRotation)for(var f=0;b>f;f++){var g=a[f],h=d.squaredLength(this.shapeOffsets[f]),i=g.computeMomentOfInertia(c);e+=i+c*h}this.inertia=e,this.invMass=this.mass>0?1/this.mass:0,this.invInertia=e>0?1/e:0};var k=d.create();c.prototype.applyForce=function(a,b){var c=k;d.sub(c,b,this.position),d.add(this.force,this.force,a);var e=d.crossLength(c,a);this.angularForce+=e},c.prototype.toLocalFrame=function(a,b){d.toLocalFrame(a,b,this.position,this.angle)},c.prototype.toWorldFrame=function(a,b){d.toGlobalFrame(a,b,this.position,this.angle)},c.prototype.fromPolygon=function(a,b){b=b||{};for(var c=this.shapes.length;c>=0;--c)this.removeShape(this.shapes[c]);var g=new e.Polygon;if(g.vertices=a,g.makeCCW(),"number"==typeof b.removeCollinearPoints&&g.removeCollinearPoints(b.removeCollinearPoints),"undefined"==typeof b.skipSimpleCheck&&!g.isSimple())return!1;this.concavePath=g.vertices.slice(0);for(var c=0;ce?(this.sleepState=c.SLEEPY,this.timeLastSleepy=a,this.emit(c.sleepyEvent)):b===c.SLEEPY&&e>f?this.wakeUp():b===c.SLEEPY&&a-this.timeLastSleepy>this.sleepTimeLimit&&this.sleep()}},c.sleepyEvent={type:"sleepy"},c.sleepEvent={type:"sleep"},c.wakeUpEvent={type:"wakeup"},c.DYNAMIC=1,c.STATIC=2,c.KINEMATIC=4,c.AWAKE=0,c.SLEEPY=1,c.SLEEPING=2},{"../collision/AABB":9,"../events/EventEmitter":28,"../math/vec2":33,"../shapes/Convex":39,"poly-decomp":7}],35:[function(a,b){function c(a,b,c){c=c||{},this.restLength="number"==typeof c.restLength?c.restLength:1,this.stiffness=c.stiffness||100,this.damping=c.damping||1,this.bodyA=a,this.bodyB=b,this.localAnchorA=d.fromValues(0,0),this.localAnchorB=d.fromValues(0,0),c.localAnchorA&&d.copy(this.localAnchorA,c.localAnchorA),c.localAnchorB&&d.copy(this.localAnchorB,c.localAnchorB),c.worldAnchorA&&this.setWorldAnchorA(c.worldAnchorA),c.worldAnchorB&&this.setWorldAnchorB(c.worldAnchorB)}var d=a("../math/vec2");b.exports=c,c.prototype.setWorldAnchorA=function(a){this.bodyA.toLocalFrame(this.localAnchorA,a)},c.prototype.setWorldAnchorB=function(a){this.bodyB.toLocalFrame(this.localAnchorB,a)},c.prototype.getWorldAnchorA=function(a){this.bodyA.toWorldFrame(a,this.localAnchorA)},c.prototype.getWorldAnchorB=function(a){this.bodyB.toWorldFrame(a,this.localAnchorB)};var e=d.create(),f=d.create(),g=d.create(),h=d.create(),i=d.create(),j=d.create(),k=d.create(),l=d.create(),m=d.create();c.prototype.applyForce=function(){var a=this.stiffness,b=this.damping,c=this.restLength,n=this.bodyA,o=this.bodyB,p=e,q=f,r=g,s=h,t=m,u=i,v=j,w=k,x=l;this.getWorldAnchorA(u),this.getWorldAnchorB(v),d.sub(w,u,n.position),d.sub(x,v,o.position),d.sub(p,v,u);var y=d.len(p);d.normalize(q,p),d.sub(r,o.velocity,n.velocity),d.crossZV(t,o.angularVelocity,x),d.add(r,r,t),d.crossZV(t,n.angularVelocity,w),d.sub(r,r,t),d.scale(s,q,-a*(y-c)-b*d.dot(r,q)),d.sub(n.force,n.force,s),d.add(o.force,o.force,s);var z=d.crossLength(w,s),A=d.crossLength(x,s);n.angularForce-=z,o.angularForce+=A}},{"../math/vec2":33}],36:[function(a,b){b.exports={AABB:a("./collision/AABB"),AngleLockEquation:a("./equations/AngleLockEquation"),Body:a("./objects/Body"),Broadphase:a("./collision/Broadphase"),Capsule:a("./shapes/Capsule"),Circle:a("./shapes/Circle"),Constraint:a("./constraints/Constraint"),ContactEquation:a("./equations/ContactEquation"),ContactMaterial:a("./material/ContactMaterial"),Convex:a("./shapes/Convex"),DistanceConstraint:a("./constraints/DistanceConstraint"),Equation:a("./equations/Equation"),EventEmitter:a("./events/EventEmitter"),FrictionEquation:a("./equations/FrictionEquation"),GearConstraint:a("./constraints/GearConstraint"),GridBroadphase:a("./collision/GridBroadphase"),GSSolver:a("./solver/GSSolver"),Island:a("./solver/IslandSolver"),IslandSolver:a("./solver/IslandSolver"),Line:a("./shapes/Line"),LockConstraint:a("./constraints/LockConstraint"),Material:a("./material/Material"),NaiveBroadphase:a("./collision/NaiveBroadphase"),Particle:a("./shapes/Particle"),Plane:a("./shapes/Plane"),RevoluteConstraint:a("./constraints/RevoluteConstraint"),PrismaticConstraint:a("./constraints/PrismaticConstraint"),Rectangle:a("./shapes/Rectangle"),RotationalVelocityEquation:a("./equations/RotationalVelocityEquation"),SAPBroadphase:a("./collision/SAPBroadphase"),Shape:a("./shapes/Shape"),Solver:a("./solver/Solver"),Spring:a("./objects/Spring"),Utils:a("./utils/Utils"),World:a("./world/World"),QuadTree:a("./collision/QuadTree").QuadTree,vec2:a("./math/vec2"),version:a("../package.json").version}},{"../package.json":8,"./collision/AABB":9,"./collision/Broadphase":10,"./collision/GridBroadphase":11,"./collision/NaiveBroadphase":12,"./collision/QuadTree":14,"./collision/SAPBroadphase":15,"./constraints/Constraint":16,"./constraints/DistanceConstraint":17,"./constraints/GearConstraint":18,"./constraints/LockConstraint":19,"./constraints/PrismaticConstraint":20,"./constraints/RevoluteConstraint":21,"./equations/AngleLockEquation":22,"./equations/ContactEquation":23,"./equations/Equation":24,"./equations/FrictionEquation":25,"./equations/RotationalVelocityEquation":27,"./events/EventEmitter":28,"./material/ContactMaterial":29,"./material/Material":30,"./math/vec2":33,"./objects/Body":34,"./objects/Spring":35,"./shapes/Capsule":37,"./shapes/Circle":38,"./shapes/Convex":39,"./shapes/Line":40,"./shapes/Particle":41,"./shapes/Plane":42,"./shapes/Rectangle":43,"./shapes/Shape":44,"./solver/GSSolver":45,"./solver/IslandSolver":47,"./solver/Solver":48,"./utils/Utils":49,"./world/World":50}],37:[function(a,b){function c(a,b){this.length=a||1,this.radius=b||1,d.call(this,d.CAPSULE)}var d=a("./Shape"),e=a("../math/vec2");b.exports=c,c.prototype=new d,c.prototype.computeMomentOfInertia=function(a){var b=this.radius,c=this.length+b,d=2*b;return a*(d*d+c*c)/12},c.prototype.updateBoundingRadius=function(){this.boundingRadius=this.radius+this.length/2},c.prototype.updateArea=function(){this.area=Math.PI*this.radius*this.radius+2*this.radius*this.length +};var f=e.create();c.prototype.computeAABB=function(a,b,c){var d=this.radius;e.set(f,this.length,0),e.rotate(f,f,c),e.set(a.upperBound,Math.max(f[0]+d,-f[0]+d),Math.max(f[1]+d,-f[1]+d)),e.set(a.lowerBound,Math.min(f[0]-d,-f[0]-d),Math.min(f[1]-d,-f[1]-d)),e.add(a.lowerBound,a.lowerBound,b),e.add(a.upperBound,a.upperBound,b)}},{"../math/vec2":33,"./Shape":44}],38:[function(a,b){function c(a){this.radius=a||1,d.call(this,d.CIRCLE)}var d=a("./Shape"),e=a("../math/vec2");b.exports=c,c.prototype=new d,c.prototype.computeMomentOfInertia=function(a){var b=this.radius;return a*b*b/2},c.prototype.updateBoundingRadius=function(){this.boundingRadius=this.radius},c.prototype.updateArea=function(){this.area=Math.PI*this.radius*this.radius},c.prototype.computeAABB=function(a,b){var c=this.radius;e.set(a.upperBound,c,c),e.set(a.lowerBound,-c,-c),b&&(e.add(a.lowerBound,a.lowerBound,b),e.add(a.upperBound,a.upperBound,b))}},{"../math/vec2":33,"./Shape":44}],39:[function(a,b){function c(a){this.vertices=a||[];for(var b=0;bg;f=g,g++){var h=this.vertices[f],i=this.vertices[g],j=Math.abs(e.crossLength(h,i)),k=e.dot(i,i)+e.dot(i,h)+e.dot(h,h);b+=j*k,c+=j}return a/6*(b/c)},c.prototype.updateBoundingRadius=function(){for(var a=this.vertices,b=0,c=0;c!==a.length;c++){var d=e.squaredLength(a[c]);d>b&&(b=d)}this.boundingRadius=Math.sqrt(b)},c.triangleArea=function(a,b,c){return.5*((b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1]))},c.prototype.updateArea=function(){this.updateTriangles(),this.area=0;for(var a=this.triangles,b=this.vertices,d=0;d!==a.length;d++){var e=a[d],f=b[e[0]],g=b[e[1]],h=b[e[2]],i=c.triangleArea(f,g,h);this.area+=i}},c.prototype.computeAABB=function(a,b,c){a.setFromPoints(this.vertices,b,c)}},{"../math/polyk":32,"../math/vec2":33,"./Shape":44,"poly-decomp":7}],40:[function(a,b){function c(a){this.length=a,d.call(this,d.LINE)}var d=a("./Shape"),e=a("../math/vec2");b.exports=c,c.prototype=new d,c.prototype.computeMomentOfInertia=function(a){return a*Math.pow(this.length,2)/12},c.prototype.updateBoundingRadius=function(){this.boundingRadius=this.length/2};var f=[e.create(),e.create()];c.prototype.computeAABB=function(a,b,c){var d=this.length;e.set(f[0],-d/2,0),e.set(f[1],d/2,0),a.setFromPoints(f,b,c)}},{"../math/vec2":33,"./Shape":44}],41:[function(a,b){function c(){d.call(this,d.PARTICLE)}var d=a("./Shape");b.exports=c,c.prototype=new d,c.prototype.computeMomentOfInertia=function(){return 0},c.prototype.updateBoundingRadius=function(){this.boundingRadius=0},c.prototype.computeAABB=function(a,b){this.length,vec2.copy(a.lowerBound,b),vec2.copy(a.upperBound,b)}},{"./Shape":44}],42:[function(a,b){function c(){d.call(this,d.PLANE)}var d=a("./Shape"),e=a("../math/vec2");a("../utils/Utils"),b.exports=c,c.prototype=new d,c.prototype.computeMomentOfInertia=function(){return 0},c.prototype.updateBoundingRadius=function(){this.boundingRadius=Number.MAX_VALUE},c.prototype.computeAABB=function(a,b,c){var d=0,f=e.set;"number"==typeof c&&(d=c%(2*Math.PI)),0==d?(f(a.lowerBound,-Number.MAX_VALUE,-Number.MAX_VALUE),f(a.upperBound,Number.MAX_VALUE,0)):d==Math.PI/2?(f(a.lowerBound,0,-Number.MAX_VALUE),f(a.upperBound,Number.MAX_VALUE,Number.MAX_VALUE)):d==Math.PI?(f(a.lowerBound,-Number.MAX_VALUE,0),f(a.upperBound,Number.MAX_VALUE,Number.MAX_VALUE)):d==3*Math.PI/2?(f(a.lowerBound,-Number.MAX_VALUE,-Number.MAX_VALUE),f(a.upperBound,0,Number.MAX_VALUE)):(f(a.lowerBound,-Number.MAX_VALUE,-Number.MAX_VALUE),f(a.upperBound,Number.MAX_VALUE,Number.MAX_VALUE)),e.add(a.lowerBound,a.lowerBound,b),e.add(a.upperBound,a.upperBound,b)},c.prototype.updateArea=function(){this.area=Number.MAX_VALUE}},{"../math/vec2":33,"../utils/Utils":49,"./Shape":44}],43:[function(a,b){function c(a,b){var c=[d.fromValues(-a/2,-b/2),d.fromValues(a/2,-b/2),d.fromValues(a/2,b/2),d.fromValues(-a/2,b/2)];this.width=a,this.height=b,e.call(this,c)}var d=a("../math/vec2"),e=(a("./Shape"),a("./Convex"));b.exports=c,c.prototype=new e,c.prototype.computeMomentOfInertia=function(a){var b=this.width,c=this.height;return a*(c*c+b*b)/12},c.prototype.updateBoundingRadius=function(){var a=this.width,b=this.height;this.boundingRadius=Math.sqrt(a*a+b*b)/2},d.create(),d.create(),d.create(),d.create(),c.prototype.computeAABB=function(a,b,c){a.setFromPoints(this.vertices,b,c)},c.prototype.updateArea=function(){this.area=this.width*this.height}},{"../math/vec2":33,"./Convex":39,"./Shape":44}],44:[function(a,b){function c(a){this.type=a,this.id=c.idCounter++,this.boundingRadius=0,this.collisionGroup=1,this.collisionMask=1,a&&this.updateBoundingRadius(),this.material=null,this.area=0,this.updateArea()}b.exports=c,c.idCounter=0,c.CIRCLE=1,c.PARTICLE=2,c.PLANE=4,c.CONVEX=8,c.LINE=16,c.RECTANGLE=32,c.CAPSULE=64,c.prototype.computeMomentOfInertia=function(){throw new Error("Shape.computeMomentOfInertia is not implemented in this Shape...")},c.prototype.updateBoundingRadius=function(){throw new Error("Shape.updateBoundingRadius is not implemented in this Shape...")},c.prototype.updateArea=function(){},c.prototype.computeAABB=function(){}},{}],45:[function(a,b){function c(a){f.call(this,a),a=a||{},this.iterations=a.iterations||10,this.tolerance=a.tolerance||0,this.debug=a.debug||!1,this.arrayStep=30,this.lambda=new g.ARRAY_TYPE(this.arrayStep),this.Bs=new g.ARRAY_TYPE(this.arrayStep),this.invCs=new g.ARRAY_TYPE(this.arrayStep),this.useGlobalEquationParameters=!0,this.stiffness=1e6,this.relaxation=4,this.useZeroRHS=!1,this.skipFrictionIterations=0}function d(a){for(var b=0;b!==a.length;b++)a[b]=0}var e=a("../math/vec2"),f=a("./Solver"),g=a("../utils/Utils"),h=a("../equations/FrictionEquation");b.exports=c,c.prototype=new f,c.prototype.solve=function(a,b){this.sortEquations();var f=0,i=this.iterations,j=this.skipFrictionIterations,k=this.tolerance*this.tolerance,l=this.equations,m=l.length,n=b.bodies,o=b.bodies.length,p=this.relaxation,q=this.stiffness,r=4/(a*a*q*(1+4*p)),s=4/(a*(1+4*p)),t=4*p/(1+4*p),u=this.useGlobalEquationParameters,v=(e.add,e.set,this.useZeroRHS),w=this.lambda;w.lengthf)){var D=u?r:z.eps,E=c.iterateEquation(C,z,D,y,x,w,v,a);B+=Math.abs(E)}if(k>=B*B)break}for(A=0;A!==o;A++)n[A].addConstraintVelocity()}},c.iterateEquation=function(a,b,c,d,e,f,g,i){var j=d[a],k=e[a],l=f[a],m=b.computeGWlambda(c);b instanceof h&&(b.maxForce=b.contactEquation.multiplier*b.frictionCoefficient*i,b.minForce=-b.contactEquation.multiplier*b.frictionCoefficient*i);var n=b.maxForce,o=b.minForce;g&&(j=0);var p=k*(j-m-c*l),q=l+p;return o>q?p=o-l:q>n&&(p=n-l),f[a]+=p,b.multiplier=f[a]/i,b.addToWlambda(p),p}},{"../equations/FrictionEquation":25,"../math/vec2":33,"../utils/Utils":49,"./Solver":48}],46:[function(a,b){function c(){this.equations=[],this.bodies=[]}b.exports=c,c.prototype.reset=function(){this.equations.length=this.bodies.length=0},c.prototype.getBodies=function(){for(var a=[],b=[],c=this.equations,d=0;d!==c.length;d++){var e=c[d];-1===b.indexOf(e.bi.id)&&(a.push(e.bi),b.push(e.bi.id)),-1===b.indexOf(e.bj.id)&&(a.push(e.bj),b.push(e.bj.id))}return a},c.prototype.solve=function(a,b){var c=[];b.removeAllEquations();for(var d=this.equations.length,e=0;e!==d;e++)b.addEquation(this.equations[e]);for(var f=this.getBodies(),g=f.length,e=0;e!==g;e++)c.push(f[e]);b.solve(a,{bodies:c})}},{}],47:[function(a,b){function c(a,b){g.call(this,b),this.subsolver=a,this.numIslands=0,this._nodePool=[],this._islandPool=[],this.beforeSolveIslandEvent={type:"beforeSolveIsland",island:null}}function d(a){for(var b=a.length,c=0;c!==b;c++){var d=a[c];if(!(d.visited||d.body.motionState&j))return d}return!1}function e(a,b,c){b.push(a.body);for(var d=a.eqs.length,e=0;e!==d;e++){var f=a.eqs[e];-1===c.indexOf(f)&&c.push(f)}}function f(a,b,c,e){for(k.length=0,k.push(a),a.visited=!0,b(a,c,e);k.length;)for(var f,g=k.pop();f=d(g.children);)f.visited=!0,b(f,c,e),k.push(f)}var g=a("./Solver"),h=(a("../math/vec2"),a("../solver/Island")),i=a("../objects/Body"),j=i.STATIC;b.exports=c,c.prototype=new g;var k=[],l=[],m=[],n=[],o=[];c.prototype.solve=function(a,b){var c=l,g=b.bodies,i=this.equations,j=i.length,k=g.length,p=(this.subsolver,this._workers,this._workerData,this._workerIslandGroups,this._islandPool);l.length=0;for(var q=0;q!==k;q++)this._nodePool.length?c.push(this._nodePool.pop()):c.push({body:g[q],children:[],eqs:[],visited:!1});for(var q=0;q!==k;q++){var r=c[q];r.body=g[q],r.children.length=0,r.eqs.length=0,r.visited=!1}for(var s=0;s!==j;s++){var t=i[s],q=g.indexOf(t.bi),u=g.indexOf(t.bj),v=c[q],w=c[u];v.children.push(w),v.eqs.push(t),w.children.push(v),w.eqs.push(t)}var x,y=0,z=m,A=n;z.length=0,A.length=0;var B=o;for(B.length=0;x=d(c);){var C=p.length?p.pop():new h;z.length=0,A.length=0,f(x,e,A,z);for(var D=z.length,q=0;q!==D;q++){var t=z[q];C.equations.push(t)}y++,B.push(C)}this.numIslands=y;for(var E=this.beforeSolveIslandEvent,q=0;qd;d++)a[d]=a[d+c];a.length=e},c.ARRAY_TYPE=Float32Array||Array},{}],50:[function(a,b){function c(a){n.apply(this),a=a||{},this.springs=[],this.bodies=[],this.solver=a.solver||new d,this.narrowphase=new x(this),this.gravity=a.gravity||f.fromValues(0,-9.78),this.doProfiling=a.doProfiling||!1,this.lastStepTime=0,this.broadphase=a.broadphase||new e,this.broadphase.setWorld(this),this.constraints=[],this.defaultFriction=.3,this.defaultRestitution=0,this.lastTimeStep=1/60,this.applySpringForces=!0,this.applyDamping=!0,this.applyGravity=!0,this.solveConstraints=!0,this.contactMaterials=[],this.time=0,this.fixedStepTime=0,this.emitImpactEvent=!0,this._constraintIdCounter=0,this._bodyIdCounter=0,this.postStepEvent={type:"postStep"},this.addBodyEvent={type:"addBody",body:null},this.removeBodyEvent={type:"removeBody",body:null},this.addSpringEvent={type:"addSpring",spring:null},this.impactEvent={type:"impact",bodyA:null,bodyB:null,shapeA:null,shapeB:null,contactEquation:null},this.postBroadphaseEvent={type:"postBroadphase",pairs:null},this.enableBodySleeping=!1,this.beginContactEvent={type:"beginContact",shapeA:null,shapeB:null,bodyA:null,bodyB:null,contactEquations:[]},this.endContactEvent={type:"endContact",shapeA:null,shapeB:null},this.overlappingShapesLastState={keys:[]},this.overlappingShapesCurrentState={keys:[]},this.overlappingShapeLookup={keys:[]}}var d=a("../solver/GSSolver"),e=a("../collision/NaiveBroadphase"),f=a("../math/vec2"),g=a("../shapes/Circle"),h=a("../shapes/Rectangle"),i=a("../shapes/Convex"),j=a("../shapes/Line"),k=a("../shapes/Plane"),l=a("../shapes/Capsule"),m=a("../shapes/Particle"),n=a("../events/EventEmitter"),o=a("../objects/Body"),p=a("../objects/Spring"),q=a("../material/Material"),r=a("../material/ContactMaterial"),s=a("../constraints/DistanceConstraint"),t=a("../constraints/LockConstraint"),u=a("../constraints/RevoluteConstraint"),v=a("../constraints/PrismaticConstraint"),w=a("../../package.json"),x=(a("../collision/Broadphase"),a("../collision/Narrowphase")),y=a("../utils/Utils");b.exports=c;var z=w.version.split(".").slice(0,2).join(".");if("undefined"==typeof performance&&(performance={}),!performance.now){var A=Date.now();performance.timing&&performance.timing.navigationStart&&(A=performance.timing.navigationStart),performance.now=function(){return Date.now()-A}}c.prototype=new Object(n.prototype),c.prototype.addConstraint=function(a){this.constraints.push(a)},c.prototype.addContactMaterial=function(a){this.contactMaterials.push(a)},c.prototype.removeContactMaterial=function(a){var b=this.contactMaterials.indexOf(a);-1!==b&&y.splice(this.contactMaterials,b,1)},c.prototype.getContactMaterial=function(a,b){for(var c=this.contactMaterials,d=0,e=c.length;d!==e;d++){var f=c[d];if(f.materialA===a&&f.materialB===b||f.materialA===b&&f.materialB===a)return f}return!1},c.prototype.removeConstraint=function(a){var b=this.constraints.indexOf(a);-1!==b&&y.splice(this.constraints,b,1)};var B=(f.create(),f.create(),f.create(),f.create(),f.create(),f.create(),f.create()),C=f.fromValues(0,0),D=f.fromValues(0,0);f.fromValues(0,0),c.prototype.step=function(a,b,c){if(c=c||10,b=b||0,0==b)this.internalStep(a),this.time+=a;else{var d=Math.floor((this.time+b)/a)-Math.floor(this.time/a);d=Math.min(d,c);for(var e=0;d>e;e++)this.internalStep(a);this.time+=b,this.fixedStepTime+=d*a;for(var f=this.time-this.fixedStepTime-a,g=0;g!==this.bodies.length;g++){var h=this.bodies[g];h.interpolatedPosition[0]=h.position[0]+h.velocity[0]*f,h.interpolatedPosition[1]=h.position[1]+h.velocity[1]*f}}},c.prototype.internalStep=function(a){var b,d,e=this,g=this.doProfiling,h=this.springs.length,i=this.springs,j=this.bodies,k=this.gravity,l=this.solver,m=this.bodies.length,n=this.broadphase,p=this.narrowphase,q=this.constraints,r=B,s=(f.scale,f.add);if(f.rotate,this.lastTimeStep=a,g&&(b=performance.now()),this.applyGravity)for(var t=0;t!==m;t++){var u=j[t],v=u.force;f.scale(r,k,u.mass),s(v,v,r)}if(this.applySpringForces)for(var t=0;t!==h;t++){var w=i[t];w.applyForce()}if(this.applyDamping)for(var t=0;t!==m;t++){var u=j[t];u.applyDamping(a)}var x=n.getCollisionPairs(this);this.postBroadphaseEvent.pairs=x,this.emit(this.postBroadphaseEvent),p.reset(this);for(var t=0,y=x.length;t!==y;t+=2)for(var z=x[t],A=x[t+1],C=0,D=z.shapes.length;C!==D;C++)for(var E=z.shapes[C],F=z.shapeOffsets[C],G=z.shapeAngles[C],H=0,I=A.shapes.length;H!==I;H++){var J=A.shapes[H],K=A.shapeOffsets[H],L=A.shapeAngles[H],M=this.defaultFriction,N=this.defaultRestitution,O=0;if(E.material&&J.material){var P=this.getContactMaterial(E.material,J.material);P&&(M=P.friction,N=P.restitution,O=P.surfaceVelocity)}this.runNarrowphase(p,z,E,F,G,A,J,K,L,M,N,O)}for(var Q=this.overlappingShapesLastState,t=0;t0&&c.integrateBody(W,a)}for(var t=0;t!==m;t++)j[t].setZeroForce();if(g&&(d=performance.now(),e.lastStepTime=d-b),this.emitImpactEvent)for(var X=this.impactEvent,t=0;t!==p.contactEquations.length;t++){var Y=p.contactEquations[t];Y.firstImpact&&(X.bodyA=Y.bi,X.bodyB=Y.bj,X.shapeA=Y.shapeA,X.shapeB=Y.shapeB,X.contactEquation=Y,this.emit(X))}if(this.enableBodySleeping)for(t=0;t!==m;t++)j[t].sleepTick(this.time);this.emit(this.postStepEvent)};var E=f.create(),F=f.create();c.integrateBody=function(a,b){var c=a.invMass,d=a.force,e=a.position,g=a.velocity;a.fixedRotation||(a.angularVelocity+=a.angularForce*a.invInertia*b,a.angle+=a.angularVelocity*b),f.scale(E,d,b*c),f.add(g,E,g),f.scale(F,g,b),f.add(e,e,F),a.aabbNeedsUpdate=!0},c.prototype.runNarrowphase=function(a,b,c,d,e,g,h,i,j,k,l,m){if(0!==(c.collisionGroup&h.collisionMask)&&0!==(h.collisionGroup&c.collisionMask)){var n=b.invMass+g.invMass;n>0&&(n=1/n),f.rotate(C,d,b.angle),f.rotate(D,i,g.angle),f.add(C,C,b.position),f.add(D,D,g.position);var o=e+b.angle,p=j+g.angle;a.enableFriction=k>0,a.frictionCoefficient=k,a.restitution=l,a.surfaceVelocity=m;var q=a[c.type|h.type],r=0;if(q&&(r=c.type=0;b--)this.removeConstraint(a[b]);for(var c=this.bodies,b=c.length-1;b>=0;b--)this.removeBody(c[b]);for(var d=this.springs,b=d.length-1;b>=0;b--)this.removeSpring(d[b]);for(var e=this.contactMaterials,b=e.length-1;b>=0;b--)this.removeContactMaterial(e[b])},c.prototype.clone=function(){var a=new c;return a.fromJSON(this.toJSON()),a};var G=f.create(),H=f.fromValues(0,0),I=f.fromValues(0,0);c.prototype.hitTest=function(a,b,c){c=c||0;var d=new o({position:a}),e=new m,h=a,j=0,n=G,p=H,q=I;d.addShape(e);for(var r=this.narrowphase,s=[],t=0,u=b.length;t!==u;t++)for(var v=b[t],w=0,x=v.shapes.length;w!==x;w++){var y=v.shapes[w],z=v.shapeOffsets[w]||p,A=v.shapeAngles[w]||0;f.rotate(n,z,v.angle),f.add(n,n,v.position);var B=A+v.angle;(y instanceof g&&r.circleParticle(v,y,n,B,d,e,h,j,!0)||y instanceof i&&r.particleConvex(d,e,h,j,v,y,n,B,!0)||y instanceof k&&r.particlePlane(d,e,h,j,v,y,n,B,!0)||y instanceof l&&r.particleCapsule(d,e,h,j,v,y,n,B,!0)||y instanceof m&&f.squaredLength(f.sub(q,n,a))0;b--){var c=Math.floor(Math.random()*(b+1)),d=a[b];a[b]=a[c],a[c]=d}return a},pad:function(a,b,c,d){if("undefined"==typeof b)var b=0;if("undefined"==typeof c)var c=" ";if("undefined"==typeof d)var d=3;var e=0;if(b+1>=a.length)switch(d){case 1:a=Array(b+1-a.length).join(c)+a;break;case 3:var f=Math.ceil((e=b-a.length)/2),g=e-f;a=Array(g+1).join(c)+a+Array(f+1).join(c);break;default:a+=Array(b+1-a.length).join(c)}return a},isPlainObject:function(a){if("object"!=typeof a||a.nodeType||a===a.window)return!1;try{if(a.constructor&&!hasOwn.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(b){return!1}return!0},extend:function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;for("boolean"==typeof h&&(k=h,h=arguments[1]||{},i=2),j===i&&(h=this,--i);j>i;i++)if(null!=(a=arguments[i]))for(c in a)d=h[c],e=a[c],h!==e&&(k&&e&&(b.Utils.isPlainObject(e)||(f=Array.isArray(e)))?(f?(f=!1,g=d&&Array.isArray(d)?d:[]):g=d&&b.Utils.isPlainObject(d)?d:{},h[c]=b.Utils.extend(k,g,e)):void 0!==e&&(h[c]=e));return h}},a.hex2rgb=function(a){return[(255&a>>16)/255,(255&a>>8)/255,(255&a)/255]},a.rgb2hex=function(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]},a.canUseNewCanvasBlendModes=function(){var a=document.createElement("canvas");a.width=1,a.height=1;var b=a.getContext("2d");return b.fillStyle="#000",b.fillRect(0,0,1,1),b.globalCompositeOperation="multiply",b.fillStyle="#fff",b.fillRect(0,0,1,1),0===b.getImageData(0,0,1,1).data[0]},a.getNextPowerOfTwo=function(a){if(a>0&&0===(a&a-1))return a;for(var b=1;a>b;)b<<=1;return b},"function"!=typeof Function.prototype.bind&&(Function.prototype.bind=function(){var a=Array.prototype.slice;return function(b){function c(){var f=e.concat(a.call(arguments));d.apply(this instanceof c?this:b,f)}var d=this,e=a.call(arguments,1);if("function"!=typeof d)throw new TypeError;return c.prototype=function f(a){return a&&(f.prototype=a),this instanceof f?void 0:new f}(d.prototype),c}}()),Array.isArray||(Array.isArray=function(a){return"[object Array]"==Object.prototype.toString.call(a)}),b.Circle=function(a,b,c){a=a||0,b=b||0,c=c||0,this.x=a,this.y=b,this._diameter=c,this._radius=c>0?.5*c:0},b.Circle.prototype={circumference:function(){return 2*Math.PI*this._radius},setTo:function(a,b,c){return this.x=a,this.y=b,this._diameter=c,this._radius=.5*c,this},copyFrom:function(a){return this.setTo(a.x,a.y,a.diameter)},copyTo:function(a){return a.x=this.x,a.y=this.y,a.diameter=this._diameter,a},distance:function(a,c){return"undefined"==typeof c&&(c=!1),c?b.Math.distanceRound(this.x,this.y,a.x,a.y):b.Math.distance(this.x,this.y,a.x,a.y)},clone:function(a){return"undefined"==typeof a?a=new b.Circle(this.x,this.y,this.diameter):a.setTo(this.x,this.y,this.diameter),a},contains:function(a,c){return b.Circle.contains(this,a,c)},circumferencePoint:function(a,c,d){return b.Circle.circumferencePoint(this,a,c,d)},offset:function(a,b){return this.x+=a,this.y+=b,this},offsetPoint:function(a){return this.offset(a.x,a.y)},toString:function(){return"[{Phaser.Circle (x="+this.x+" y="+this.y+" diameter="+this.diameter+" radius="+this.radius+")}]"}},b.Circle.prototype.constructor=b.Circle,Object.defineProperty(b.Circle.prototype,"diameter",{get:function(){return this._diameter},set:function(a){a>0&&(this._diameter=a,this._radius=.5*a)}}),Object.defineProperty(b.Circle.prototype,"radius",{get:function(){return this._radius},set:function(a){a>0&&(this._radius=a,this._diameter=2*a)}}),Object.defineProperty(b.Circle.prototype,"left",{get:function(){return this.x-this._radius},set:function(a){a>this.x?(this._radius=0,this._diameter=0):this.radius=this.x-a}}),Object.defineProperty(b.Circle.prototype,"right",{get:function(){return this.x+this._radius},set:function(a){athis.y?(this._radius=0,this._diameter=0):this.radius=this.y-a}}),Object.defineProperty(b.Circle.prototype,"bottom",{get:function(){return this.y+this._radius},set:function(a){a0?Math.PI*this._radius*this._radius:0}}),Object.defineProperty(b.Circle.prototype,"empty",{get:function(){return 0===this._diameter},set:function(a){a===!0&&this.setTo(0,0,0)}}),b.Circle.contains=function(a,b,c){if(a.radius>0&&b>=a.left&&b<=a.right&&c>=a.top&&c<=a.bottom){var d=(a.x-b)*(a.x-b),e=(a.y-c)*(a.y-c);return d+e<=a.radius*a.radius}return!1},b.Circle.equals=function(a,b){return a.x==b.x&&a.y==b.y&&a.diameter==b.diameter},b.Circle.intersects=function(a,c){return b.Math.distance(a.x,a.y,c.x,c.y)<=a.radius+c.radius},b.Circle.circumferencePoint=function(a,c,d,e){return"undefined"==typeof d&&(d=!1),"undefined"==typeof e&&(e=new b.Point),d===!0&&(c=b.Math.radToDeg(c)),e.x=a.x+a.radius*Math.cos(c),e.y=a.y+a.radius*Math.sin(c),e},b.Circle.intersectsRectangle=function(a,b){var c=Math.abs(a.x-b.x-b.halfWidth),d=b.halfWidth+a.radius;if(c>d)return!1;var e=Math.abs(a.y-b.y-b.halfHeight),f=b.halfHeight+a.radius;if(e>f)return!1;if(c<=b.halfWidth||e<=b.halfHeight)return!0;var g=c-b.halfWidth,h=e-b.halfHeight,i=g*g,j=h*h,k=a.radius*a.radius;return k>=i+j},a.Circle=b.Circle,b.Point=function(a,b){a=a||0,b=b||0,this.x=a,this.y=b},b.Point.prototype={copyFrom:function(a){return this.setTo(a.x,a.y)},invert:function(){return this.setTo(this.y,this.x)},setTo:function(a,b){return this.x=a||0,this.y=b||(0!==b?this.x:0),this},set:function(a,b){return this.x=a||0,this.y=b||(0!==b?this.x:0),this},add:function(a,b){return this.x+=a,this.y+=b,this},subtract:function(a,b){return this.x-=a,this.y-=b,this},multiply:function(a,b){return this.x*=a,this.y*=b,this},divide:function(a,b){return this.x/=a,this.y/=b,this},clampX:function(a,c){return this.x=b.Math.clamp(this.x,a,c),this},clampY:function(a,c){return this.y=b.Math.clamp(this.y,a,c),this},clamp:function(a,c){return this.x=b.Math.clamp(this.x,a,c),this.y=b.Math.clamp(this.y,a,c),this},clone:function(a){return"undefined"==typeof a?a=new b.Point(this.x,this.y):a.setTo(this.x,this.y),a},copyTo:function(a){return a.x=this.x,a.y=this.y,a},distance:function(a,c){return b.Point.distance(this,a,c)},equals:function(a){return a.x==this.x&&a.y==this.y},rotate:function(a,c,d,e,f){return b.Point.rotate(this,a,c,d,e,f)},getMagnitude:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},setMagnitude:function(a){return this.normalize().multiply(a,a)},normalize:function(){if(!this.isZero()){var a=this.getMagnitude();this.x/=a,this.y/=a}return this},isZero:function(){return 0===this.x&&0===this.y},toString:function(){return"[{Point (x="+this.x+" y="+this.y+")}]"}},b.Point.prototype.constructor=b.Point,b.Point.add=function(a,c,d){return"undefined"==typeof d&&(d=new b.Point),d.x=a.x+c.x,d.y=a.y+c.y,d},b.Point.subtract=function(a,c,d){return"undefined"==typeof d&&(d=new b.Point),d.x=a.x-c.x,d.y=a.y-c.y,d},b.Point.multiply=function(a,c,d){return"undefined"==typeof d&&(d=new b.Point),d.x=a.x*c.x,d.y=a.y*c.y,d},b.Point.divide=function(a,c,d){return"undefined"==typeof d&&(d=new b.Point),d.x=a.x/c.x,d.y=a.y/c.y,d},b.Point.equals=function(a,b){return a.x==b.x&&a.y==b.y},b.Point.distance=function(a,c,d){return"undefined"==typeof d&&(d=!1),d?b.Math.distanceRound(a.x,a.y,c.x,c.y):b.Math.distance(a.x,a.y,c.x,c.y)},b.Point.rotate=function(a,c,d,e,f,g){return f=f||!1,g=g||null,f&&(e=b.Math.degToRad(e)),null===g&&(g=Math.sqrt((c-a.x)*(c-a.x)+(d-a.y)*(d-a.y))),a.setTo(c+g*Math.cos(e),d+g*Math.sin(e))},a.Point=b.Point,b.Rectangle=function(a,b,c,d){a=a||0,b=b||0,c=c||0,d=d||0,this.x=a,this.y=b,this.width=c,this.height=d},b.Rectangle.prototype={offset:function(a,b){return this.x+=a,this.y+=b,this},offsetPoint:function(a){return this.offset(a.x,a.y)},setTo:function(a,b,c,d){return this.x=a,this.y=b,this.width=c,this.height=d,this},floor:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y)},floorAll:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.width=Math.floor(this.width),this.height=Math.floor(this.height)},copyFrom:function(a){return this.setTo(a.x,a.y,a.width,a.height)},copyTo:function(a){return a.x=this.x,a.y=this.y,a.width=this.width,a.height=this.height,a},inflate:function(a,c){return b.Rectangle.inflate(this,a,c)},size:function(a){return b.Rectangle.size(this,a)},clone:function(a){return b.Rectangle.clone(this,a)},contains:function(a,c){return b.Rectangle.contains(this,a,c)},containsRect:function(a){return b.Rectangle.containsRect(this,a)},equals:function(a){return b.Rectangle.equals(this,a)},intersection:function(a,c){return b.Rectangle.intersection(this,a,c)},intersects:function(a,c){return b.Rectangle.intersects(this,a,c)},intersectsRaw:function(a,c,d,e,f){return b.Rectangle.intersectsRaw(this,a,c,d,e,f)},union:function(a,c){return b.Rectangle.union(this,a,c)},toString:function(){return"[{Rectangle (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+" empty="+this.empty+")}]"},get halfWidth(){return Math.round(this.width/2)},get halfHeight(){return Math.round(this.height/2)},get bottom(){return this.y+this.height},set bottom(a){this.height=a<=this.y?0:this.y-a},get bottomRight(){return new b.Point(this.right,this.bottom)},set bottomRight(a){this.right=a.x,this.bottom=a.y},get left(){return this.x},set left(a){this.width=a>=this.right?0:this.right-a,this.x=a},get right(){return this.x+this.width},set right(a){this.width=a<=this.x?0:this.x+a},get volume(){return this.width*this.height},get perimeter(){return 2*this.width+2*this.height},get centerX(){return this.x+this.halfWidth},set centerX(a){this.x=a-this.halfWidth},get centerY(){return this.y+this.halfHeight},set centerY(a){this.y=a-this.halfHeight},get top(){return this.y},set top(a){a>=this.bottom?(this.height=0,this.y=a):this.height=this.bottom-a},get topLeft(){return new b.Point(this.x,this.y)},set topLeft(a){this.x=a.x,this.y=a.y},get empty(){return!this.width||!this.height},set empty(a){a===!0&&this.setTo(0,0,0,0)}},b.Rectangle.prototype.constructor=b.Rectangle,b.Rectangle.inflate=function(a,b,c){return a.x-=b,a.width+=2*b,a.y-=c,a.height+=2*c,a},b.Rectangle.inflatePoint=function(a,c){return b.Rectangle.inflate(a,c.x,c.y)},b.Rectangle.size=function(a,c){return"undefined"==typeof c?c=new b.Point(a.width,a.height):c.setTo(a.width,a.height),c},b.Rectangle.clone=function(a,c){return"undefined"==typeof c?c=new b.Rectangle(a.x,a.y,a.width,a.height):c.setTo(a.x,a.y,a.width,a.height),c},b.Rectangle.contains=function(a,b,c){return a.width<=0||a.height<=0?!1:b>=a.x&&b<=a.right&&c>=a.y&&c<=a.bottom},b.Rectangle.containsRaw=function(a,b,c,d,e,f){return e>=a&&a+c>=e&&f>=b&&b+d>=f},b.Rectangle.containsPoint=function(a,c){return b.Rectangle.contains(a,c.x,c.y)},b.Rectangle.containsRect=function(a,b){return a.volume>b.volume?!1:a.x>=b.x&&a.y>=b.y&&a.right<=b.right&&a.bottom<=b.bottom},b.Rectangle.equals=function(a,b){return a.x==b.x&&a.y==b.y&&a.width==b.width&&a.height==b.height},b.Rectangle.intersection=function(a,c,d){return"undefined"==typeof d&&(d=new b.Rectangle),b.Rectangle.intersects(a,c)&&(d.x=Math.max(a.x,c.x),d.y=Math.max(a.y,c.y),d.width=Math.min(a.right,c.right)-d.x,d.height=Math.min(a.bottom,c.bottom)-d.y),d},b.Rectangle.intersects=function(a,b){return a.width<=0||a.height<=0||b.width<=0||b.height<=0?!1:!(a.rightb.right||a.y>b.bottom)},b.Rectangle.intersectsRaw=function(a,b,c,d,e,f){return"undefined"==typeof f&&(f=0),!(b>a.right+f||ca.bottom+f||e=c&&d>=a&&b>=e&&f>=b}},Object.defineProperty(b.Line.prototype,"length",{get:function(){return Math.sqrt((this.end.x-this.start.x)*(this.end.x-this.start.x)+(this.end.y-this.start.y)*(this.end.y-this.start.y))}}),Object.defineProperty(b.Line.prototype,"angle",{get:function(){return Math.atan2(this.end.x-this.start.x,this.end.y-this.start.y)}}),Object.defineProperty(b.Line.prototype,"slope",{get:function(){return(this.end.y-this.start.y)/(this.end.x-this.start.x)}}),Object.defineProperty(b.Line.prototype,"perpSlope",{get:function(){return-((this.end.x-this.start.x)/(this.end.y-this.start.y))}}),b.Line.intersectsPoints=function(a,c,d,e,f,g){"undefined"==typeof f&&(f=!0),"undefined"==typeof g&&(g=new b.Point);var h=c.y-a.y,i=e.y-d.y,j=a.x-c.x,k=d.x-e.x,l=c.x*a.y-a.x*c.y,m=e.x*d.y-d.x*e.y,n=h*k-i*j;if(0===n)return null;if(g.x=(j*m-k*l)/n,g.y=(i*l-h*m)/n,f){if(Math.pow(g.x-c.x+(g.y-c.y),2)>Math.pow(a.x-c.x+(a.y-c.y),2))return null;if(Math.pow(g.x-a.x+(g.y-a.y),2)>Math.pow(a.x-c.x+(a.y-c.y),2))return null;if(Math.pow(g.x-e.x+(g.y-e.y),2)>Math.pow(d.x-e.x+(d.y-e.y),2))return null;if(Math.pow(g.x-d.x+(g.y-d.y),2)>Math.pow(d.x-e.x+(d.y-e.y),2))return null}return g},b.Line.intersects=function(a,c,d,e){return b.Line.intersectsPoints(a.start,a.end,c.start,c.end,d,e)},b.Ellipse=function(a,c,d,e){this.type=b.ELLIPSE,a=a||0,c=c||0,d=d||0,e=e||0,this.x=a,this.y=c,this.width=d,this.height=e},b.Ellipse.prototype={setTo:function(a,b,c,d){return this.x=a,this.y=b,this.width=c,this.height=d,this},copyFrom:function(a){return this.setTo(a.x,a.y,a.width,a.height)},copyTo:function(a){return a.x=this.x,a.y=this.y,a.width=this.width,a.height=this.height,a},clone:function(a){return"undefined"==typeof a?a=new b.Ellipse(this.x,this.y,this.width,this.height):a.setTo(this.x,this.y,this.width,this.height),a},contains:function(a,c){return b.Ellipse.contains(this,a,c)},toString:function(){return"[{Phaser.Ellipse (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+")}]"}},b.Ellipse.prototype.constructor=b.Ellipse,Object.defineProperty(b.Ellipse.prototype,"left",{get:function(){return this.x},set:function(a){this.x=a}}),Object.defineProperty(b.Ellipse.prototype,"right",{get:function(){return this.x+this.width},set:function(a){this.width=ad+e},b.Ellipse.prototype.getBounds=function(){return new b.Rectangle(this.x,this.y,this.width,this.height)},a.Ellipse=b.Ellipse,b.Polygon=function(a){if(this.type=b.POLYGON,a instanceof Array||(a=Array.prototype.slice.call(arguments)),"number"==typeof a[0]){for(var c=[],d=0,e=a.length;e>d;d+=2)c.push(new b.Point(a[d],a[d+1]));a=c}this.points=a},b.Polygon.prototype={clone:function(){for(var a=[],c=0;cb!=i>b&&(h-f)*(b-g)/(i-g)+f>a;j&&(c=!0)}return c}},b.Polygon.prototype.constructor=b.Polygon,a.Polygon=b.Polygon,a.determineMatrixArrayType=function(){return"undefined"!=typeof Float32Array?Float32Array:Array},a.Matrix2=a.determineMatrixArrayType(),a.Matrix=function(){this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0},a.Matrix.prototype.fromArray=function(a){this.a=a[0],this.b=a[1],this.c=a[3],this.d=a[4],this.tx=a[2],this.ty=a[5]},a.Matrix.prototype.toArray=function(a){this.array||(this.array=new Float32Array(9));var b=this.array;return a?(this.array[0]=this.a,this.array[1]=this.c,this.array[2]=0,this.array[3]=this.b,this.array[4]=this.d,this.array[5]=0,this.array[6]=this.tx,this.array[7]=this.ty,this.array[8]=1):(this.array[0]=this.a,this.array[1]=this.b,this.array[2]=this.tx,this.array[3]=this.c,this.array[4]=this.d,this.array[5]=this.ty,this.array[6]=0,this.array[7]=0,this.array[8]=1),b},a.identityMatrix=new a.Matrix,a.DisplayObject=function(){this.position=new a.Point,this.scale=new a.Point(1,1),this.pivot=new a.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.buttonMode=!1,this.renderable=!1,this.parent=null,this.stage=null,this.worldAlpha=1,this._interactive=!1,this.defaultCursor="pointer",this.worldTransform=new a.Matrix,this.color=[],this.dynamic=!0,this._sr=0,this._cr=1,this.filterArea=new a.Rectangle(0,0,1,1),this._bounds=new a.Rectangle(0,0,1,1),this._currentBounds=null,this._mask=null,this._cacheAsBitmap=!1,this._cacheIsDirty=!1},a.DisplayObject.prototype.constructor=a.DisplayObject,a.DisplayObject.prototype.setInteractive=function(a){this.interactive=a},Object.defineProperty(a.DisplayObject.prototype,"interactive",{get:function(){return this._interactive},set:function(a){this._interactive=a,this.stage&&(this.stage.dirty=!0)}}),Object.defineProperty(a.DisplayObject.prototype,"worldVisible",{get:function(){var a=this;do{if(!a.visible)return!1;a=a.parent}while(a);return!0}}),Object.defineProperty(a.DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(a){this._mask&&(this._mask.isMask=!1),this._mask=a,this._mask&&(this._mask.isMask=!0)}}),Object.defineProperty(a.DisplayObject.prototype,"filters",{get:function(){return this._filters},set:function(a){if(a){for(var b=[],c=0;c=0&&b<=this.children.length))throw new Error(a+" The index "+b+" supplied is out of bounds "+this.children.length);a.parent&&a.parent.removeChild(a),a.parent=this,this.children.splice(b,0,a),this.stage&&a.setStageReference(this.stage)},a.DisplayObjectContainer.prototype.swapChildren=function(a,b){if(a!==b){var c=this.children.indexOf(a),d=this.children.indexOf(b);if(0>c||0>d)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[c]=b,this.children[d]=a}},a.DisplayObjectContainer.prototype.getChildAt=function(a){if(a>=0&&ab;b++)this.children[b].updateTransform()},a.DisplayObjectContainer.prototype.getBounds=function(b){if(0===this.children.length)return a.EmptyRectangle;if(b){var c=this.worldTransform;this.worldTransform=b,this.updateTransform(),this.worldTransform=c}for(var d,e,f,g=1/0,h=1/0,i=-1/0,j=-1/0,k=!1,l=0,m=this.children.length;m>l;l++){var n=this.children[l];n.visible&&(k=!0,d=this.children[l].getBounds(b),g=ge?i:e,j=j>f?j:f)}if(!k)return a.EmptyRectangle;var o=this._bounds;return o.x=g,o.y=h,o.width=i-g,o.height=j-h,o},a.DisplayObjectContainer.prototype.getLocalBounds=function(){var b=this.worldTransform;this.worldTransform=a.identityMatrix;for(var c=0,d=this.children.length;d>c;c++)this.children[c].updateTransform();var e=this.getBounds();return this.worldTransform=b,e},a.DisplayObjectContainer.prototype.setStageReference=function(a){this.stage=a,this._interactive&&(this.stage.dirty=!0);for(var b=0,c=this.children.length;c>b;b++){var d=this.children[b];d.setStageReference(a)}},a.DisplayObjectContainer.prototype.removeStageReference=function(){for(var a=0,b=this.children.length;b>a;a++){var c=this.children[a];c.removeStageReference()}this._interactive&&(this.stage.dirty=!0),this.stage=null},a.DisplayObjectContainer.prototype._renderWebGL=function(a){if(this.visible&&!(this.alpha<=0)){if(this._cacheAsBitmap)return this._renderCachedSprite(a),void 0;var b,c;if(this._mask||this._filters){for(this._mask&&(a.spriteBatch.stop(),a.maskManager.pushMask(this.mask,a),a.spriteBatch.start()),this._filters&&(a.spriteBatch.flush(),a.filterManager.pushFilter(this._filterBlock)),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a);a.spriteBatch.stop(),this._filters&&a.filterManager.popFilter(),this._mask&&a.maskManager.popMask(a),a.spriteBatch.start()}else for(b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a)}},a.DisplayObjectContainer.prototype._renderCanvas=function(a){if(this.visible!==!1&&0!==this.alpha){if(this._cacheAsBitmap)return this._renderCachedSprite(a),void 0;this._mask&&a.maskManager.pushMask(this._mask,a.context);for(var b=0,c=this.children.length;c>b;b++){var d=this.children[b];d._renderCanvas(a)}this._mask&&a.maskManager.popMask(a.context)}},a.Sprite=function(b){a.DisplayObjectContainer.call(this),this.anchor=new a.Point,this.texture=b,this._width=0,this._height=0,this.tint=16777215,this.blendMode=a.blendModes.NORMAL,b.baseTexture.hasLoaded?this.onTextureUpdate():(this.onTextureUpdateBind=this.onTextureUpdate.bind(this),this.texture.addEventListener("update",this.onTextureUpdateBind)),this.renderable=!0},a.Sprite.prototype=Object.create(a.DisplayObjectContainer.prototype),a.Sprite.prototype.constructor=a.Sprite,Object.defineProperty(a.Sprite.prototype,"width",{get:function(){return this.scale.x*this.texture.frame.width},set:function(a){this.scale.x=a/this.texture.frame.width,this._width=a}}),Object.defineProperty(a.Sprite.prototype,"height",{get:function(){return this.scale.y*this.texture.frame.height},set:function(a){this.scale.y=a/this.texture.frame.height,this._height=a}}),a.Sprite.prototype.setTexture=function(a){this.texture.baseTexture!==a.baseTexture?(this.textureChange=!0,this.texture=a):this.texture=a,this.cachedTint=16777215,this.updateFrame=!0},a.Sprite.prototype.onTextureUpdate=function(){this._width&&(this.scale.x=this._width/this.texture.frame.width),this._height&&(this.scale.y=this._height/this.texture.frame.height),this.updateFrame=!0},a.Sprite.prototype.getBounds=function(a){var b=this.texture.frame.width,c=this.texture.frame.height,d=b*(1-this.anchor.x),e=b*-this.anchor.x,f=c*(1-this.anchor.y),g=c*-this.anchor.y,h=a||this.worldTransform,i=h.a,j=h.c,k=h.b,l=h.d,m=h.tx,n=h.ty,o=i*e+k*g+m,p=l*g+j*e+n,q=i*d+k*g+m,r=l*g+j*d+n,s=i*d+k*f+m,t=l*f+j*d+n,u=i*e+k*f+m,v=l*f+j*e+n,w=-1/0,x=-1/0,y=1/0,z=1/0;y=y>o?o:y,y=y>q?q:y,y=y>s?s:y,y=y>u?u:y,z=z>p?p:z,z=z>r?r:z,z=z>t?t:z,z=z>v?v:z,w=o>w?o:w,w=q>w?q:w,w=s>w?s:w,w=u>w?u:w,x=p>x?p:x,x=r>x?r:x,x=t>x?t:x,x=v>x?v:x;var A=this._bounds;return A.x=y,A.width=w-y,A.y=z,A.height=x-z,this._currentBounds=A,A},a.Sprite.prototype._renderWebGL=function(a){if(this.visible&&!(this.alpha<=0)){var b,c;if(this._mask||this._filters){var d=a.spriteBatch;for(this._mask&&(d.stop(),a.maskManager.pushMask(this.mask,a),d.start()),this._filters&&(d.flush(),a.filterManager.pushFilter(this._filterBlock)),d.render(this),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a);d.stop(),this._filters&&a.filterManager.popFilter(),this._mask&&a.maskManager.popMask(a),d.start()}else for(a.spriteBatch.render(this),b=0,c=this.children.length;c>b;b++)this.children[b]._renderWebGL(a)}},a.Sprite.prototype._renderCanvas=function(b){if(this.visible!==!1&&0!==this.alpha){var c=this.texture.frame,d=b.context,e=this.texture;if(this.blendMode!==b.currentBlendMode&&(b.currentBlendMode=this.blendMode,d.globalCompositeOperation=a.blendModesCanvas[b.currentBlendMode]),this._mask&&b.maskManager.pushMask(this._mask,b.context),c&&c.width&&c.height&&e.baseTexture.source){d.globalAlpha=this.worldAlpha;var f=this.worldTransform;if(b.roundPixels?d.setTransform(f.a,f.c,f.b,f.d,f.tx||0,f.ty||0):d.setTransform(f.a,f.c,f.b,f.d,f.tx,f.ty),b.smoothProperty&&b.scaleMode!==this.texture.baseTexture.scaleMode&&(b.scaleMode=this.texture.baseTexture.scaleMode,d[b.smoothProperty]=b.scaleMode===a.scaleModes.LINEAR),16777215!==this.tint){if(this.cachedTint!==this.tint){if(!e.baseTexture.hasLoaded)return;this.cachedTint=this.tint,this.tintedTexture=a.CanvasTinter.getTintedTexture(this,this.tint)}d.drawImage(this.tintedTexture,0,0,c.width,c.height,this.anchor.x*-c.width,this.anchor.y*-c.height,c.width,c.height)}else if(e.trim){var g=e.trim;d.drawImage(this.texture.baseTexture.source,c.x,c.y,c.width,c.height,g.x-this.anchor.x*g.width,g.y-this.anchor.y*g.height,c.width,c.height)}else d.drawImage(this.texture.baseTexture.source,c.x,c.y,c.width,c.height,this.anchor.x*-c.width,this.anchor.y*-c.height,c.width,c.height)}for(var h=0,i=this.children.length;i>h;h++){var j=this.children[h];j._renderCanvas(b)}this._mask&&b.maskManager.popMask(b.context)}},a.Sprite.fromFrame=function(b){var c=a.TextureCache[b];if(!c)throw new Error('The frameId "'+b+'" does not exist in the texture cache'+this);return new a.Sprite(c)},a.Sprite.fromImage=function(b,c,d){var e=a.Texture.fromImage(b,c,d);return new a.Sprite(e)},a.SpriteBatch=function(b){a.DisplayObjectContainer.call(this),this.textureThing=b,this.ready=!1},a.SpriteBatch.prototype=Object.create(a.DisplayObjectContainer.prototype),a.SpriteBatch.constructor=a.SpriteBatch,a.SpriteBatch.prototype.initWebGL=function(b){this.fastSpriteBatch=new a.WebGLFastSpriteBatch(b),this.ready=!0},a.SpriteBatch.prototype.updateTransform=function(){a.DisplayObject.prototype.updateTransform.call(this)},a.SpriteBatch.prototype._renderWebGL=function(a){!this.visible||this.alpha<=0||!this.children.length||(this.ready||this.initWebGL(a.gl),a.spriteBatch.stop(),a.shaderManager.activateShader(a.shaderManager.fastShader),this.fastSpriteBatch.begin(this,a),this.fastSpriteBatch.render(this),a.shaderManager.activateShader(a.shaderManager.defaultShader),a.spriteBatch.start())},a.SpriteBatch.prototype._renderCanvas=function(b){var c=b.context;c.globalAlpha=this.worldAlpha,a.DisplayObject.prototype.updateTransform.call(this);for(var d=this.worldTransform,e=!0,f=0;fe?(g>0&&(b+="\n"),b+=f[g]+" ",e=this.style.wordWrapWidth-h):(e-=i,b+=f[g]+" ")}d=2?parseInt(c[c.length-2],10):a.BitmapText.fonts[this.fontName].size,this.dirty=!0,this.tint=b.tint},a.BitmapText.prototype.updateText=function(){for(var b=a.BitmapText.fonts[this.fontName],c=new a.Point,d=null,e=[],f=0,g=[],h=0,i=this.fontSize/b.size,j=0;j=j;j++){var n=0;"right"===this.style.align?n=f-g[j]:"center"===this.style.align&&(n=(f-g[j])/2),m.push(n)}var o=this.children.length,p=e.length,q=this.tint||16777215;for(j=0;p>j;j++){var r=o>j?this.children[j]:this._pool.pop();r?r.setTexture(e[j].texture):r=new a.Sprite(e[j].texture),r.position.x=(e[j].position.x+m[e[j].line])*i,r.position.y=e[j].position.y*i,r.scale.x=r.scale.y=i,r.tint=q,r.parent||this.addChild(r)}for(;this.children.length>p;){var s=this.getChildAt(this.children.length-1);this._pool.push(s),this.removeChild(s)}this.textWidth=f*i,this.textHeight=(c.y+b.lineHeight)*i},a.BitmapText.prototype.updateTransform=function(){this.dirty&&(this.updateText(),this.dirty=!1),a.DisplayObjectContainer.prototype.updateTransform.call(this)},a.BitmapText.fonts={},a.Stage=function(b){a.DisplayObjectContainer.call(this),this.worldTransform=new a.Matrix,this.interactive=!0,this.interactionManager=new a.InteractionManager(this),this.dirty=!0,this.stage=this,this.stage.hitArea=new a.Rectangle(0,0,1e5,1e5),this.setBackgroundColor(b) +},a.Stage.prototype=Object.create(a.DisplayObjectContainer.prototype),a.Stage.prototype.constructor=a.Stage,a.Stage.prototype.setInteractionDelegate=function(a){this.interactionManager.setTargetDomElement(a)},a.Stage.prototype.updateTransform=function(){this.worldAlpha=1;for(var a=0,b=this.children.length;b>a;a++)this.children[a].updateTransform();this.dirty&&(this.dirty=!1,this.interactionManager.dirty=!0),this.interactive&&this.interactionManager.update()},a.Stage.prototype.setBackgroundColor=function(b){this.backgroundColor=b||0,this.backgroundColorSplit=a.hex2rgb(this.backgroundColor);var c=this.backgroundColor.toString(16);c="000000".substr(0,6-c.length)+c,this.backgroundColorString="#"+c},a.Stage.prototype.getMousePosition=function(){return this.interactionManager.mouse.global},a.EventTarget=function(){var a={};this.addEventListener=this.on=function(b,c){void 0===a[b]&&(a[b]=[]),-1===a[b].indexOf(c)&&a[b].push(c)},this.dispatchEvent=this.emit=function(b){if(a[b.type]&&a[b.type].length)for(var c=0,d=a[b.type].length;d>c;c++)a[b.type][c](b)},this.removeEventListener=this.off=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)},this.removeAllEventListeners=function(b){var c=a[b];c&&(c.length=0)}},a.PolyK={},a.PolyK.Triangulate=function(b){var c=!0,d=b.length>>1;if(3>d)return[];for(var e=[],f=[],g=0;d>g;g++)f.push(g);g=0;for(var h=d;h>3;){var i=f[(g+0)%h],j=f[(g+1)%h],k=f[(g+2)%h],l=b[2*i],m=b[2*i+1],n=b[2*j],o=b[2*j+1],p=b[2*k],q=b[2*k+1],r=!1;if(a.PolyK._convex(l,m,n,o,p,q,c)){r=!0;for(var s=0;h>s;s++){var t=f[s];if(t!==i&&t!==j&&t!==k&&a.PolyK._PointInTriangle(b[2*t],b[2*t+1],l,m,n,o,p,q)){r=!1;break}}}if(r)e.push(i,j,k),f.splice((g+1)%h,1),h--,g=0;else if(g++>3*h){if(!c)return window.console.log("PIXI Warning: shape too complex to fill"),[];for(e=[],f=[],g=0;d>g;g++)f.push(g);g=0,h=d,c=!1}}return e.push(f[0],f[1],f[2]),e},a.PolyK._PointInTriangle=function(a,b,c,d,e,f,g,h){var i=g-c,j=h-d,k=e-c,l=f-d,m=a-c,n=b-d,o=i*i+j*j,p=i*k+j*l,q=i*m+j*n,r=k*k+l*l,s=k*m+l*n,t=1/(o*r-p*p),u=(r*q-p*s)*t,v=(o*s-p*q)*t;return u>=0&&v>=0&&1>u+v},a.PolyK._convex=function(a,b,c,d,e,f,g){return(b-d)*(e-c)+(c-a)*(f-d)>=0===g},a.initDefaultShaders=function(){},a.CompileVertexShader=function(b,c){return a._CompileShader(b,c,b.VERTEX_SHADER)},a.CompileFragmentShader=function(b,c){return a._CompileShader(b,c,b.FRAGMENT_SHADER)},a._CompileShader=function(a,b,c){var d=b.join("\n"),e=a.createShader(c);return a.shaderSource(e,d),a.compileShader(e),a.getShaderParameter(e,a.COMPILE_STATUS)?e:(window.console.log(a.getShaderInfoLog(e)),null)},a.compileProgram=function(b,c,d){var e=a.CompileFragmentShader(b,d),f=a.CompileVertexShader(b,c),g=b.createProgram();return b.attachShader(g,f),b.attachShader(g,e),b.linkProgram(g),b.getProgramParameter(g,b.LINK_STATUS)||window.console.log("Could not initialise shaders"),g},a.PixiShader=function(a){this.gl=a,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying vec4 vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.textureCount=0,this.attributes=[],this.init()},a.PixiShader.prototype.init=function(){var b=this.gl,c=a.compileProgram(b,this.vertexSrc||a.PixiShader.defaultVertexSrc,this.fragmentSrc);b.useProgram(c),this.uSampler=b.getUniformLocation(c,"uSampler"),this.projectionVector=b.getUniformLocation(c,"projectionVector"),this.offsetVector=b.getUniformLocation(c,"offsetVector"),this.dimensions=b.getUniformLocation(c,"dimensions"),this.aVertexPosition=b.getAttribLocation(c,"aVertexPosition"),this.aTextureCoord=b.getAttribLocation(c,"aTextureCoord"),this.colorAttribute=b.getAttribLocation(c,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aTextureCoord,this.colorAttribute];for(var d in this.uniforms)this.uniforms[d].uniformLocation=b.getUniformLocation(c,d);this.initUniforms(),this.program=c},a.PixiShader.prototype.initUniforms=function(){this.textureCount=1;var a,b=this.gl;for(var c in this.uniforms){a=this.uniforms[c];var d=a.type;"sampler2D"===d?(a._init=!1,null!==a.value&&this.initSampler2D(a)):"mat2"===d||"mat3"===d||"mat4"===d?(a.glMatrix=!0,a.glValueLength=1,"mat2"===d?a.glFunc=b.uniformMatrix2fv:"mat3"===d?a.glFunc=b.uniformMatrix3fv:"mat4"===d&&(a.glFunc=b.uniformMatrix4fv)):(a.glFunc=b["uniform"+d],a.glValueLength="2f"===d||"2i"===d?2:"3f"===d||"3i"===d?3:"4f"===d||"4i"===d?4:1)}},a.PixiShader.prototype.initSampler2D=function(a){if(a.value&&a.value.baseTexture&&a.value.baseTexture.hasLoaded){var b=this.gl;if(b.activeTexture(b["TEXTURE"+this.textureCount]),b.bindTexture(b.TEXTURE_2D,a.value.baseTexture._glTexture),a.textureData){var c=a.textureData,d=c.magFilter?c.magFilter:b.LINEAR,e=c.minFilter?c.minFilter:b.LINEAR,f=c.wrapS?c.wrapS:b.CLAMP_TO_EDGE,g=c.wrapT?c.wrapT:b.CLAMP_TO_EDGE,h=c.luminance?b.LUMINANCE:b.RGBA;if(c.repeat&&(f=b.REPEAT,g=b.REPEAT),b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,!!c.flipY),c.width){var i=c.width?c.width:512,j=c.height?c.height:2,k=c.border?c.border:0;b.texImage2D(b.TEXTURE_2D,0,h,i,j,k,h,b.UNSIGNED_BYTE,null)}else b.texImage2D(b.TEXTURE_2D,0,h,b.RGBA,b.UNSIGNED_BYTE,a.value.baseTexture.source);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,d),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,f),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,g)}b.uniform1i(a.uniformLocation,this.textureCount),a._init=!0,this.textureCount++}},a.PixiShader.prototype.syncUniforms=function(){this.textureCount=1;var b,c=this.gl;for(var d in this.uniforms)b=this.uniforms[d],1===b.glValueLength?b.glMatrix===!0?b.glFunc.call(c,b.uniformLocation,b.transpose,b.value):b.glFunc.call(c,b.uniformLocation,b.value):2===b.glValueLength?b.glFunc.call(c,b.uniformLocation,b.value.x,b.value.y):3===b.glValueLength?b.glFunc.call(c,b.uniformLocation,b.value.x,b.value.y,b.value.z):4===b.glValueLength?b.glFunc.call(c,b.uniformLocation,b.value.x,b.value.y,b.value.z,b.value.w):"sampler2D"===b.type&&(b._init?(c.activeTexture(c["TEXTURE"+this.textureCount]),c.bindTexture(c.TEXTURE_2D,b.value.baseTexture._glTextures[c.id]||a.createWebGLTexture(b.value.baseTexture,c)),c.uniform1i(b.uniformLocation,this.textureCount),this.textureCount++):this.initSampler2D(b))},a.PixiShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},a.PixiShader.defaultVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute vec2 aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying vec4 vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vec3 color = mod(vec3(aColor.y/65536.0, aColor.y/256.0, aColor.y), 256.0) / 256.0;"," vColor = vec4(color * aColor.x, aColor.x);","}"],a.PixiFastShader=function(a){this.gl=a,this.program=null,this.fragmentSrc=["precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor ;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"],this.textureCount=0,this.init()},a.PixiFastShader.prototype.init=function(){var b=this.gl,c=a.compileProgram(b,this.vertexSrc,this.fragmentSrc);b.useProgram(c),this.uSampler=b.getUniformLocation(c,"uSampler"),this.projectionVector=b.getUniformLocation(c,"projectionVector"),this.offsetVector=b.getUniformLocation(c,"offsetVector"),this.dimensions=b.getUniformLocation(c,"dimensions"),this.uMatrix=b.getUniformLocation(c,"uMatrix"),this.aVertexPosition=b.getAttribLocation(c,"aVertexPosition"),this.aPositionCoord=b.getAttribLocation(c,"aPositionCoord"),this.aScale=b.getAttribLocation(c,"aScale"),this.aRotation=b.getAttribLocation(c,"aRotation"),this.aTextureCoord=b.getAttribLocation(c,"aTextureCoord"),this.colorAttribute=b.getAttribLocation(c,"aColor"),-1===this.colorAttribute&&(this.colorAttribute=2),this.attributes=[this.aVertexPosition,this.aPositionCoord,this.aScale,this.aRotation,this.aTextureCoord,this.colorAttribute],this.program=c},a.PixiFastShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attributes=null},a.StripShader=function(){this.program=null,this.fragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying float vColor;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));"," gl_FragColor = gl_FragColor * alpha;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","varying vec2 vTextureCoord;","uniform vec2 offsetVector;","varying float vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition, 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = aColor;","}"]},a.StripShader.prototype.init=function(){var b=a.gl,c=a.compileProgram(b,this.vertexSrc,this.fragmentSrc);b.useProgram(c),this.uSampler=b.getUniformLocation(c,"uSampler"),this.projectionVector=b.getUniformLocation(c,"projectionVector"),this.offsetVector=b.getUniformLocation(c,"offsetVector"),this.colorAttribute=b.getAttribLocation(c,"aColor"),this.aVertexPosition=b.getAttribLocation(c,"aVertexPosition"),this.aTextureCoord=b.getAttribLocation(c,"aTextureCoord"),this.translationMatrix=b.getUniformLocation(c,"translationMatrix"),this.alpha=b.getUniformLocation(c,"alpha"),this.program=c},a.PrimitiveShader=function(a){this.gl=a,this.program=null,this.fragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {"," gl_FragColor = vColor;","}"],this.vertexSrc=["attribute vec2 aVertexPosition;","attribute vec4 aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform float alpha;","uniform vec3 tint;","varying vec4 vColor;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vColor = aColor * vec4(tint * alpha, alpha);","}"],this.init()},a.PrimitiveShader.prototype.init=function(){var b=this.gl,c=a.compileProgram(b,this.vertexSrc,this.fragmentSrc);b.useProgram(c),this.projectionVector=b.getUniformLocation(c,"projectionVector"),this.offsetVector=b.getUniformLocation(c,"offsetVector"),this.tintColor=b.getUniformLocation(c,"tint"),this.aVertexPosition=b.getAttribLocation(c,"aVertexPosition"),this.colorAttribute=b.getAttribLocation(c,"aColor"),this.attributes=[this.aVertexPosition,this.colorAttribute],this.translationMatrix=b.getUniformLocation(c,"translationMatrix"),this.alpha=b.getUniformLocation(c,"alpha"),this.program=c},a.PrimitiveShader.prototype.destroy=function(){this.gl.deleteProgram(this.program),this.uniforms=null,this.gl=null,this.attribute=null},a.WebGLGraphics=function(){},a.WebGLGraphics.renderGraphics=function(b,c){var d=c.gl,e=c.projection,f=c.offset,g=c.shaderManager.primitiveShader;b._webGL[d.id]||(b._webGL[d.id]={points:[],indices:[],lastIndex:0,buffer:d.createBuffer(),indexBuffer:d.createBuffer()});var h=b._webGL[d.id];b.dirty&&(b.dirty=!1,b.clearDirty&&(b.clearDirty=!1,h.lastIndex=0,h.points=[],h.indices=[]),a.WebGLGraphics.updateGraphics(b,d)),c.shaderManager.activatePrimitiveShader(),d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA),d.uniformMatrix3fv(g.translationMatrix,!1,b.worldTransform.toArray(!0)),d.uniform2f(g.projectionVector,e.x,-e.y),d.uniform2f(g.offsetVector,-f.x,-f.y),d.uniform3fv(g.tintColor,a.hex2rgb(b.tint)),d.uniform1f(g.alpha,b.worldAlpha),d.bindBuffer(d.ARRAY_BUFFER,h.buffer),d.vertexAttribPointer(g.aVertexPosition,2,d.FLOAT,!1,24,0),d.vertexAttribPointer(g.colorAttribute,4,d.FLOAT,!1,24,8),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,h.indexBuffer),d.drawElements(d.TRIANGLE_STRIP,h.indices.length,d.UNSIGNED_SHORT,0),c.shaderManager.deactivatePrimitiveShader()},a.WebGLGraphics.updateGraphics=function(b,c){for(var d=b._webGL[c.id],e=d.lastIndex;e3&&a.WebGLGraphics.buildPoly(f,d),f.lineWidth>0&&a.WebGLGraphics.buildLine(f,d)):f.type===a.Graphics.RECT?a.WebGLGraphics.buildRectangle(f,d):(f.type===a.Graphics.CIRC||f.type===a.Graphics.ELIP)&&a.WebGLGraphics.buildCircle(f,d)}d.lastIndex=b.graphicsData.length,d.glPoints=new Float32Array(d.points),c.bindBuffer(c.ARRAY_BUFFER,d.buffer),c.bufferData(c.ARRAY_BUFFER,d.glPoints,c.STATIC_DRAW),d.glIndicies=new Uint16Array(d.indices),c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,d.indexBuffer),c.bufferData(c.ELEMENT_ARRAY_BUFFER,d.glIndicies,c.STATIC_DRAW)},a.WebGLGraphics.buildRectangle=function(b,c){var d=b.points,e=d[0],f=d[1],g=d[2],h=d[3];if(b.fill){var i=a.hex2rgb(b.fillColor),j=b.fillAlpha,k=i[0]*j,l=i[1]*j,m=i[2]*j,n=c.points,o=c.indices,p=n.length/6;n.push(e,f),n.push(k,l,m,j),n.push(e+g,f),n.push(k,l,m,j),n.push(e,f+h),n.push(k,l,m,j),n.push(e+g,f+h),n.push(k,l,m,j),o.push(p,p,p+1,p+2,p+3,p+3)}if(b.lineWidth){var q=b.points;b.points=[e,f,e+g,f,e+g,f+h,e,f+h,e,f],a.WebGLGraphics.buildLine(b,c),b.points=q}},a.WebGLGraphics.buildCircle=function(b,c){var d=b.points,e=d[0],f=d[1],g=d[2],h=d[3],i=40,j=2*Math.PI/i,k=0;if(b.fill){var l=a.hex2rgb(b.fillColor),m=b.fillAlpha,n=l[0]*m,o=l[1]*m,p=l[2]*m,q=c.points,r=c.indices,s=q.length/6;for(r.push(s),k=0;i+1>k;k++)q.push(e,f,n,o,p,m),q.push(e+Math.sin(j*k)*g,f+Math.cos(j*k)*h,n,o,p,m),r.push(s++,s++);r.push(s-1)}if(b.lineWidth){var t=b.points;for(b.points=[],k=0;i+1>k;k++)b.points.push(e+Math.sin(j*k)*g,f+Math.cos(j*k)*h);a.WebGLGraphics.buildLine(b,c),b.points=t}},a.WebGLGraphics.buildLine=function(b,c){var d=0,e=b.points;if(0!==e.length){if(b.lineWidth%2)for(d=0;dd;d++)l=e[2*(d-1)],m=e[2*(d-1)+1],n=e[2*d],o=e[2*d+1],p=e[2*(d+1)],q=e[2*(d+1)+1],r=-(m-o),s=l-n,F=Math.sqrt(r*r+s*s),r/=F,s/=F,r*=L,s*=L,t=-(o-q),u=n-p,F=Math.sqrt(t*t+u*u),t/=F,u/=F,t*=L,u*=L,x=-s+m-(-s+o),y=-r+n-(-r+l),z=(-r+l)*(-s+o)-(-r+n)*(-s+m),A=-u+q-(-u+o),B=-t+n-(-t+p),C=(-t+p)*(-u+o)-(-t+n)*(-u+q),D=x*B-A*y,Math.abs(D)<.1?(D+=10.1,G.push(n-r,o-s,O,P,Q,N),G.push(n+r,o+s,O,P,Q,N)):(j=(y*C-B*z)/D,k=(A*z-x*C)/D,E=(j-n)*(j-n)+(k-o)+(k-o),E>19600?(v=r-t,w=s-u,F=Math.sqrt(v*v+w*w),v/=F,w/=F,v*=L,w*=L,G.push(n-v,o-w),G.push(O,P,Q,N),G.push(n+v,o+w),G.push(O,P,Q,N),G.push(n-v,o-w),G.push(O,P,Q,N),J++):(G.push(j,k),G.push(O,P,Q,N),G.push(n-(j-n),o-(k-o)),G.push(O,P,Q,N)));for(l=e[2*(I-2)],m=e[2*(I-2)+1],n=e[2*(I-1)],o=e[2*(I-1)+1],r=-(m-o),s=l-n,F=Math.sqrt(r*r+s*s),r/=F,s/=F,r*=L,s*=L,G.push(n-r,o-s),G.push(O,P,Q,N),G.push(n+r,o+s),G.push(O,P,Q,N),H.push(K),d=0;J>d;d++)H.push(K++);H.push(K-1)}},a.WebGLGraphics.buildPoly=function(b,c){var d=b.points;if(!(d.length<6)){var e=c.points,f=c.indices,g=d.length/2,h=a.hex2rgb(b.fillColor),i=b.fillAlpha,j=h[0]*i,k=h[1]*i,l=h[2]*i,m=a.PolyK.Triangulate(d),n=e.length/6,o=0;for(o=0;oo;o++)e.push(d[2*o],d[2*o+1],j,k,l,i)}},a.glContexts=[],a.WebGLRenderer=function(b,c,d,e,f){a.defaultRenderer||(a.defaultRenderer=this),this.type=a.WEBGL_RENDERER,this.transparent=!!e,this.width=b||800,this.height=c||600,this.view=d||document.createElement("canvas"),this.view.width=this.width,this.view.height=this.height,this.contextLost=this.handleContextLost.bind(this),this.contextRestoredLost=this.handleContextRestored.bind(this),this.view.addEventListener("webglcontextlost",this.contextLost,!1),this.view.addEventListener("webglcontextrestored",this.contextRestoredLost,!1),this.options={alpha:this.transparent,antialias:!!f,premultipliedAlpha:!!e,stencil:!0};try{this.gl=this.view.getContext("experimental-webgl",this.options)}catch(g){try{this.gl=this.view.getContext("webgl",this.options)}catch(h){throw new Error(" This browser does not support webGL. Try using the canvas renderer"+this)}}var i=this.gl;this.glContextId=i.id=a.WebGLRenderer.glContextId++,a.glContexts[this.glContextId]=i,a.blendModesWebGL||(a.blendModesWebGL=[],a.blendModesWebGL[a.blendModes.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.ADD]=[i.SRC_ALPHA,i.DST_ALPHA],a.blendModesWebGL[a.blendModes.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.SCREEN]=[i.SRC_ALPHA,i.ONE],a.blendModesWebGL[a.blendModes.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],a.blendModesWebGL[a.blendModes.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA]),this.projection=new a.Point,this.projection.x=this.width/2,this.projection.y=-this.height/2,this.offset=new a.Point(0,0),this.resize(this.width,this.height),this.contextLost=!1,this.shaderManager=new a.WebGLShaderManager(i),this.spriteBatch=new a.WebGLSpriteBatch(i),this.maskManager=new a.WebGLMaskManager(i),this.filterManager=new a.WebGLFilterManager(i,this.transparent),this.renderSession={},this.renderSession.gl=this.gl,this.renderSession.drawCount=0,this.renderSession.shaderManager=this.shaderManager,this.renderSession.maskManager=this.maskManager,this.renderSession.filterManager=this.filterManager,this.renderSession.spriteBatch=this.spriteBatch,this.renderSession.renderer=this,i.useProgram(this.shaderManager.defaultShader.program),i.disable(i.DEPTH_TEST),i.disable(i.CULL_FACE),i.enable(i.BLEND),i.colorMask(!0,!0,!0,this.transparent)},a.WebGLRenderer.prototype.constructor=a.WebGLRenderer,a.WebGLRenderer.prototype.render=function(b){if(!this.contextLost){this.__stage!==b&&(b.interactive&&b.interactionManager.removeEvents(),this.__stage=b),a.WebGLRenderer.updateTextures(),b.updateTransform(),b._interactive&&(b._interactiveEventsAdded||(b._interactiveEventsAdded=!0,b.interactionManager.setTarget(this)));var c=this.gl;c.viewport(0,0,this.width,this.height),c.bindFramebuffer(c.FRAMEBUFFER,null),this.transparent?c.clearColor(0,0,0,0):c.clearColor(b.backgroundColorSplit[0],b.backgroundColorSplit[1],b.backgroundColorSplit[2],1),c.clear(c.COLOR_BUFFER_BIT),this.renderDisplayObject(b,this.projection),b.interactive?b._interactiveEventsAdded||(b._interactiveEventsAdded=!0,b.interactionManager.setTarget(this)):b._interactiveEventsAdded&&(b._interactiveEventsAdded=!1,b.interactionManager.setTarget(this))}},a.WebGLRenderer.prototype.renderDisplayObject=function(a,b,c){this.renderSession.drawCount=0,this.renderSession.currentBlendMode=9999,this.renderSession.projection=b,this.renderSession.offset=this.offset,this.spriteBatch.begin(this.renderSession),this.filterManager.begin(this.renderSession,c),a._renderWebGL(this.renderSession),this.spriteBatch.end()},a.WebGLRenderer.updateTextures=function(){var b=0;for(b=0;b=0;c--){var d=b._glTextures[c],e=a.glContexts[c];e&&d&&e.deleteTexture(d)}b._glTextures.length=0},a.WebGLRenderer.updateTextureFrame=function(a){a.updateFrame=!1,a._updateWebGLuvs()},a.WebGLRenderer.prototype.resize=function(a,b){this.width=a,this.height=b,this.view.width=a,this.view.height=b,this.gl.viewport(0,0,this.width,this.height),this.projection.x=this.width/2,this.projection.y=-this.height/2},a.createWebGLTexture=function(b,c){return b.hasLoaded&&(b._glTextures[c.id]=c.createTexture(),c.bindTexture(c.TEXTURE_2D,b._glTextures[c.id]),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.source),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,b.scaleMode===a.scaleModes.LINEAR?c.LINEAR:c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,b.scaleMode===a.scaleModes.LINEAR?c.LINEAR:c.NEAREST),b._powerOf2?(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.REPEAT),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.REPEAT)):(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE)),c.bindTexture(c.TEXTURE_2D,null)),b._glTextures[c.id]},a.updateWebGLTexture=function(b,c){b._glTextures[c.id]&&(c.bindTexture(c.TEXTURE_2D,b._glTextures[c.id]),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.source),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,b.scaleMode===a.scaleModes.LINEAR?c.LINEAR:c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,b.scaleMode===a.scaleModes.LINEAR?c.LINEAR:c.NEAREST),b._powerOf2?(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.REPEAT),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.REPEAT)):(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE)),c.bindTexture(c.TEXTURE_2D,null))},a.WebGLRenderer.prototype.handleContextLost=function(a){a.preventDefault(),this.contextLost=!0},a.WebGLRenderer.prototype.handleContextRestored=function(){try{this.gl=this.view.getContext("experimental-webgl",this.options)}catch(b){try{this.gl=this.view.getContext("webgl",this.options)}catch(c){throw new Error(" This browser does not support webGL. Try using the canvas renderer"+this)}}var d=this.gl;d.id=a.WebGLRenderer.glContextId++,this.shaderManager.setContext(d),this.spriteBatch.setContext(d),this.maskManager.setContext(d),this.filterManager.setContext(d),this.renderSession.gl=this.gl,d.disable(d.DEPTH_TEST),d.disable(d.CULL_FACE),d.enable(d.BLEND),d.colorMask(!0,!0,!0,this.transparent),this.gl.viewport(0,0,this.width,this.height);for(var e in a.TextureCache){var f=a.TextureCache[e].baseTexture;f._glTextures=[]}this.contextLost=!1},a.WebGLRenderer.prototype.destroy=function(){this.view.removeEventListener("webglcontextlost",this.contextLost),this.view.removeEventListener("webglcontextrestored",this.contextRestoredLost),a.glContexts[this.glContextId]=null,this.projection=null,this.offset=null,this.shaderManager.destroy(),this.spriteBatch.destroy(),this.maskManager.destroy(),this.filterManager.destroy(),this.shaderManager=null,this.spriteBatch=null,this.maskManager=null,this.filterManager=null,this.gl=null,this.renderSession=null},a.WebGLRenderer.glContextId=0,a.WebGLMaskManager=function(a){this.maskStack=[],this.maskPosition=0,this.setContext(a)},a.WebGLMaskManager.prototype.setContext=function(a){this.gl=a},a.WebGLMaskManager.prototype.pushMask=function(b,c){var d=this.gl;0===this.maskStack.length&&(d.enable(d.STENCIL_TEST),d.stencilFunc(d.ALWAYS,1,1)),this.maskStack.push(b),d.colorMask(!1,!1,!1,!0),d.stencilOp(d.KEEP,d.KEEP,d.INCR),a.WebGLGraphics.renderGraphics(b,c),d.colorMask(!0,!0,!0,!0),d.stencilFunc(d.NOTEQUAL,0,this.maskStack.length),d.stencilOp(d.KEEP,d.KEEP,d.KEEP)},a.WebGLMaskManager.prototype.popMask=function(b){var c=this.gl,d=this.maskStack.pop();d&&(c.colorMask(!1,!1,!1,!1),c.stencilOp(c.KEEP,c.KEEP,c.DECR),a.WebGLGraphics.renderGraphics(d,b),c.colorMask(!0,!0,!0,!0),c.stencilFunc(c.NOTEQUAL,0,this.maskStack.length),c.stencilOp(c.KEEP,c.KEEP,c.KEEP)),0===this.maskStack.length&&c.disable(c.STENCIL_TEST)},a.WebGLMaskManager.prototype.destroy=function(){this.maskStack=null,this.gl=null},a.WebGLShaderManager=function(a){this.maxAttibs=10,this.attribState=[],this.tempAttribState=[];for(var b=0;bd;d+=6,e+=4)this.indices[d+0]=e+0,this.indices[d+1]=e+1,this.indices[d+2]=e+2,this.indices[d+3]=e+0,this.indices[d+4]=e+2,this.indices[d+5]=e+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.setContext(a)},a.WebGLSpriteBatch.prototype.setContext=function(a){this.gl=a,this.vertexBuffer=a.createBuffer(),this.indexBuffer=a.createBuffer(),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,this.indices,a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bufferData(a.ARRAY_BUFFER,this.vertices,a.DYNAMIC_DRAW),this.currentBlendMode=99999},a.WebGLSpriteBatch.prototype.begin=function(a){this.renderSession=a,this.shader=this.renderSession.shaderManager.defaultShader,this.start()},a.WebGLSpriteBatch.prototype.end=function(){this.flush()},a.WebGLSpriteBatch.prototype.render=function(a){var b=a.texture;(b.baseTexture!==this.currentBaseTexture||this.currentBatchSize>=this.size)&&(this.flush(),this.currentBaseTexture=b.baseTexture),a.blendMode!==this.currentBlendMode&&this.setBlendMode(a.blendMode);var c=a._uvs||a.texture._uvs;if(c){var d,e,f,g,h=a.worldAlpha,i=a.tint,j=this.vertices,k=a.anchor.x,l=a.anchor.y;if(a.texture.trim){var m=a.texture.trim;e=m.x-k*m.width,d=e+b.frame.width,g=m.y-l*m.height,f=g+b.frame.height}else d=b.frame.width*(1-k),e=b.frame.width*-k,f=b.frame.height*(1-l),g=b.frame.height*-l;var n=4*this.currentBatchSize*this.vertSize,o=a.worldTransform,p=o.a,q=o.c,r=o.b,s=o.d,t=o.tx,u=o.ty;j[n++]=p*e+r*g+t,j[n++]=s*g+q*e+u,j[n++]=c.x0,j[n++]=c.y0,j[n++]=h,j[n++]=i,j[n++]=p*d+r*g+t,j[n++]=s*g+q*d+u,j[n++]=c.x1,j[n++]=c.y1,j[n++]=h,j[n++]=i,j[n++]=p*d+r*f+t,j[n++]=s*f+q*d+u,j[n++]=c.x2,j[n++]=c.y2,j[n++]=h,j[n++]=i,j[n++]=p*e+r*f+t,j[n++]=s*f+q*e+u,j[n++]=c.x3,j[n++]=c.y3,j[n++]=h,j[n++]=i,this.currentBatchSize++}},a.WebGLSpriteBatch.prototype.renderTilingSprite=function(b){var c=b.tilingTexture;(c.baseTexture!==this.currentBaseTexture||this.currentBatchSize>=this.size)&&(this.flush(),this.currentBaseTexture=c.baseTexture),b.blendMode!==this.currentBlendMode&&this.setBlendMode(b.blendMode),b._uvs||(b._uvs=new a.TextureUvs);var d=b._uvs;b.tilePosition.x%=c.baseTexture.width*b.tileScaleOffset.x,b.tilePosition.y%=c.baseTexture.height*b.tileScaleOffset.y;var e=b.tilePosition.x/(c.baseTexture.width*b.tileScaleOffset.x),f=b.tilePosition.y/(c.baseTexture.height*b.tileScaleOffset.y),g=b.width/c.baseTexture.width/(b.tileScale.x*b.tileScaleOffset.x),h=b.height/c.baseTexture.height/(b.tileScale.y*b.tileScaleOffset.y);d.x0=0-e,d.y0=0-f,d.x1=1*g-e,d.y1=0-f,d.x2=1*g-e,d.y2=1*h-f,d.x3=0-e,d.y3=1*h-f;var i=b.worldAlpha,j=b.tint,k=this.vertices,l=b.width,m=b.height,n=b.anchor.x,o=b.anchor.y,p=l*(1-n),q=l*-n,r=m*(1-o),s=m*-o,t=4*this.currentBatchSize*this.vertSize,u=b.worldTransform,v=u.a,w=u.c,x=u.b,y=u.d,z=u.tx,A=u.ty;k[t++]=v*q+x*s+z,k[t++]=y*s+w*q+A,k[t++]=d.x0,k[t++]=d.y0,k[t++]=i,k[t++]=j,k[t++]=v*p+x*s+z,k[t++]=y*s+w*p+A,k[t++]=d.x1,k[t++]=d.y1,k[t++]=i,k[t++]=j,k[t++]=v*p+x*r+z,k[t++]=y*r+w*p+A,k[t++]=d.x2,k[t++]=d.y2,k[t++]=i,k[t++]=j,k[t++]=v*q+x*r+z,k[t++]=y*r+w*q+A,k[t++]=d.x3,k[t++]=d.y3,k[t++]=i,k[t++]=j,this.currentBatchSize++},a.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var b=this.gl;if(b.bindTexture(b.TEXTURE_2D,this.currentBaseTexture._glTextures[b.id]||a.createWebGLTexture(this.currentBaseTexture,b)),this.currentBatchSize>.5*this.size)b.bufferSubData(b.ARRAY_BUFFER,0,this.vertices);else{var c=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);b.bufferSubData(b.ARRAY_BUFFER,0,c)}b.drawElements(b.TRIANGLES,6*this.currentBatchSize,b.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},a.WebGLSpriteBatch.prototype.stop=function(){this.flush()},a.WebGLSpriteBatch.prototype.start=function(){var b=this.gl;b.activeTexture(b.TEXTURE0),b.bindBuffer(b.ARRAY_BUFFER,this.vertexBuffer),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var c=this.renderSession.projection;b.uniform2f(this.shader.projectionVector,c.x,c.y);var d=4*this.vertSize;b.vertexAttribPointer(this.shader.aVertexPosition,2,b.FLOAT,!1,d,0),b.vertexAttribPointer(this.shader.aTextureCoord,2,b.FLOAT,!1,d,8),b.vertexAttribPointer(this.shader.colorAttribute,2,b.FLOAT,!1,d,16),this.currentBlendMode!==a.blendModes.NORMAL&&this.setBlendMode(a.blendModes.NORMAL)},a.WebGLSpriteBatch.prototype.setBlendMode=function(b){this.flush(),this.currentBlendMode=b;var c=a.blendModesWebGL[this.currentBlendMode];this.gl.blendFunc(c[0],c[1])},a.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null +},a.WebGLFastSpriteBatch=function(a){this.vertSize=10,this.maxSize=6e3,this.size=this.maxSize;var b=4*this.size*this.vertSize,c=6*this.maxSize;this.vertices=new Float32Array(b),this.indices=new Uint16Array(c),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var d=0,e=0;c>d;d+=6,e+=4)this.indices[d+0]=e+0,this.indices[d+1]=e+1,this.indices[d+2]=e+2,this.indices[d+3]=e+0,this.indices[d+4]=e+2,this.indices[d+5]=e+3;this.drawing=!1,this.currentBatchSize=0,this.currentBaseTexture=null,this.currentBlendMode=0,this.renderSession=null,this.shader=null,this.matrix=null,this.setContext(a)},a.WebGLFastSpriteBatch.prototype.setContext=function(a){this.gl=a,this.vertexBuffer=a.createBuffer(),this.indexBuffer=a.createBuffer(),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.indexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,this.indices,a.STATIC_DRAW),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.bufferData(a.ARRAY_BUFFER,this.vertices,a.DYNAMIC_DRAW),this.currentBlendMode=99999},a.WebGLFastSpriteBatch.prototype.begin=function(a,b){this.renderSession=b,this.shader=this.renderSession.shaderManager.fastShader,this.matrix=a.worldTransform.toArray(!0),this.start()},a.WebGLFastSpriteBatch.prototype.end=function(){this.flush()},a.WebGLFastSpriteBatch.prototype.render=function(a){var b=a.children,c=b[0];if(c.texture._uvs){this.currentBaseTexture=c.texture.baseTexture,c.blendMode!==this.currentBlendMode&&this.setBlendMode(c.blendMode);for(var d=0,e=b.length;e>d;d++)this.renderSprite(b[d]);this.flush()}},a.WebGLFastSpriteBatch.prototype.renderSprite=function(a){if(a.texture.baseTexture===this.currentBaseTexture||(this.flush(),this.currentBaseTexture=a.texture.baseTexture,a.texture._uvs)){var b,c,d,e,f,g,h,i,j=this.vertices;if(b=a.texture._uvs,c=a.texture.frame.width,d=a.texture.frame.height,a.texture.trim){var k=a.texture.trim;f=k.x-a.anchor.x*k.width,e=f+a.texture.frame.width,h=k.y-a.anchor.y*k.height,g=h+a.texture.frame.height}else e=a.texture.frame.width*(1-a.anchor.x),f=a.texture.frame.width*-a.anchor.x,g=a.texture.frame.height*(1-a.anchor.y),h=a.texture.frame.height*-a.anchor.y;i=4*this.currentBatchSize*this.vertSize,j[i++]=f,j[i++]=h,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x0,j[i++]=b.y1,j[i++]=a.alpha,j[i++]=e,j[i++]=h,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x1,j[i++]=b.y1,j[i++]=a.alpha,j[i++]=e,j[i++]=g,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x2,j[i++]=b.y2,j[i++]=a.alpha,j[i++]=f,j[i++]=g,j[i++]=a.position.x,j[i++]=a.position.y,j[i++]=a.scale.x,j[i++]=a.scale.y,j[i++]=a.rotation,j[i++]=b.x3,j[i++]=b.y3,j[i++]=a.alpha,this.currentBatchSize++,this.currentBatchSize>=this.size&&this.flush()}},a.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var b=this.gl;if(this.currentBaseTexture._glTextures[b.id]||a.createWebGLTexture(this.currentBaseTexture,b),b.bindTexture(b.TEXTURE_2D,this.currentBaseTexture._glTextures[b.id]),this.currentBatchSize>.5*this.size)b.bufferSubData(b.ARRAY_BUFFER,0,this.vertices);else{var c=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);b.bufferSubData(b.ARRAY_BUFFER,0,c)}b.drawElements(b.TRIANGLES,6*this.currentBatchSize,b.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}},a.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},a.WebGLFastSpriteBatch.prototype.start=function(){var b=this.gl;b.activeTexture(b.TEXTURE0),b.bindBuffer(b.ARRAY_BUFFER,this.vertexBuffer),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var c=this.renderSession.projection;b.uniform2f(this.shader.projectionVector,c.x,c.y),b.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var d=4*this.vertSize;b.vertexAttribPointer(this.shader.aVertexPosition,2,b.FLOAT,!1,d,0),b.vertexAttribPointer(this.shader.aPositionCoord,2,b.FLOAT,!1,d,8),b.vertexAttribPointer(this.shader.aScale,2,b.FLOAT,!1,d,16),b.vertexAttribPointer(this.shader.aRotation,1,b.FLOAT,!1,d,24),b.vertexAttribPointer(this.shader.aTextureCoord,2,b.FLOAT,!1,d,28),b.vertexAttribPointer(this.shader.colorAttribute,1,b.FLOAT,!1,d,36),this.currentBlendMode!==a.blendModes.NORMAL&&this.setBlendMode(a.blendModes.NORMAL)},a.WebGLFastSpriteBatch.prototype.setBlendMode=function(b){this.flush(),this.currentBlendMode=b;var c=a.blendModesWebGL[this.currentBlendMode];this.gl.blendFunc(c[0],c[1])},a.WebGLFilterManager=function(a,b){this.transparent=b,this.filterStack=[],this.offsetX=0,this.offsetY=0,this.setContext(a)},a.WebGLFilterManager.prototype.setContext=function(a){this.gl=a,this.texturePool=[],this.initShaderBuffers()},a.WebGLFilterManager.prototype.begin=function(a,b){this.renderSession=a,this.defaultShader=a.shaderManager.defaultShader;var c=this.renderSession.projection;this.width=2*c.x,this.height=2*-c.y,this.buffer=b},a.WebGLFilterManager.prototype.pushFilter=function(b){var c=this.gl,d=this.renderSession.projection,e=this.renderSession.offset;this.filterStack.push(b);var f=b.filterPasses[0];this.offsetX+=b.target.filterArea.x,this.offsetY+=b.target.filterArea.y;var g=this.texturePool.pop();g?g.resize(this.width,this.height):g=new a.FilterTexture(this.gl,this.width,this.height),c.bindTexture(c.TEXTURE_2D,g.texture),b.target.filterArea=b.target.getBounds();var h=b.target.filterArea,i=f.padding;h.x-=i,h.y-=i,h.width+=2*i,h.height+=2*i,h.x<0&&(h.x=0),h.width>this.width&&(h.width=this.width),h.y<0&&(h.y=0),h.height>this.height&&(h.height=this.height),c.bindFramebuffer(c.FRAMEBUFFER,g.frameBuffer),c.viewport(0,0,h.width,h.height),d.x=h.width/2,d.y=-h.height/2,e.x=-h.x,e.y=-h.y,c.uniform2f(this.defaultShader.projectionVector,h.width/2,-h.height/2),c.uniform2f(this.defaultShader.offsetVector,-h.x,-h.y),c.colorMask(!0,!0,!0,!0),c.clearColor(0,0,0,0),c.clear(c.COLOR_BUFFER_BIT),b._glFilterTexture=g},a.WebGLFilterManager.prototype.popFilter=function(){var b=this.gl,c=this.filterStack.pop(),d=c.target.filterArea,e=c._glFilterTexture,f=this.renderSession.projection,g=this.renderSession.offset;if(c.filterPasses.length>1){b.viewport(0,0,d.width,d.height),b.bindBuffer(b.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=d.height,this.vertexArray[2]=d.width,this.vertexArray[3]=d.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=d.width,this.vertexArray[7]=0,b.bufferSubData(b.ARRAY_BUFFER,0,this.vertexArray),b.bindBuffer(b.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=d.width/this.width,this.uvArray[5]=d.height/this.height,this.uvArray[6]=d.width/this.width,this.uvArray[7]=d.height/this.height,b.bufferSubData(b.ARRAY_BUFFER,0,this.uvArray);var h=e,i=this.texturePool.pop();i||(i=new a.FilterTexture(this.gl,this.width,this.height)),i.resize(this.width,this.height),b.bindFramebuffer(b.FRAMEBUFFER,i.frameBuffer),b.clear(b.COLOR_BUFFER_BIT),b.disable(b.BLEND);for(var j=0;j0&&(a.Texture.frameUpdates.length=0)},a.CanvasRenderer.prototype.resize=function(a,b){this.width=a,this.height=b,this.view.width=a,this.view.height=b},a.CanvasRenderer.prototype.renderDisplayObject=function(a,b){this.renderSession.context=b||this.context,a._renderCanvas(this.renderSession)},a.CanvasRenderer.prototype.renderStripFlat=function(a){var b=this.context,c=a.verticies,d=c.length/2;this.count++,b.beginPath();for(var e=1;d-2>e;e++){var f=2*e,g=c[f],h=c[f+2],i=c[f+4],j=c[f+1],k=c[f+3],l=c[f+5];b.moveTo(g,j),b.lineTo(h,k),b.lineTo(i,l)}b.fillStyle="#FF0000",b.fill(),b.closePath()},a.CanvasRenderer.prototype.renderStrip=function(a){var b=this.context,c=a.verticies,d=a.uvs,e=c.length/2;this.count++;for(var f=1;e-2>f;f++){var g=2*f,h=c[g],i=c[g+2],j=c[g+4],k=c[g+1],l=c[g+3],m=c[g+5],n=d[g]*a.texture.width,o=d[g+2]*a.texture.width,p=d[g+4]*a.texture.width,q=d[g+1]*a.texture.height,r=d[g+3]*a.texture.height,s=d[g+5]*a.texture.height;b.save(),b.beginPath(),b.moveTo(h,k),b.lineTo(i,l),b.lineTo(j,m),b.closePath(),b.clip();var t=n*r+q*p+o*s-r*p-q*o-n*s,u=h*r+q*j+i*s-r*j-q*i-h*s,v=n*i+h*p+o*j-i*p-h*o-n*j,w=n*r*j+q*i*p+h*o*s-h*r*p-q*o*j-n*i*s,x=k*r+q*m+l*s-r*m-q*l-k*s,y=n*l+k*p+o*m-l*p-k*o-n*m,z=n*r*m+q*l*p+k*o*s-k*r*p-q*o*m-n*l*s;b.transform(u/t,x/t,v/t,y/t,w/t,z/t),b.drawImage(a.texture.baseTexture.source,0,0),b.restore()}},a.CanvasBuffer=function(a,b){this.width=a,this.height=b,this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.canvas.width=a,this.canvas.height=b},a.CanvasBuffer.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)},a.CanvasBuffer.prototype.resize=function(a,b){this.width=this.canvas.width=a,this.height=this.canvas.height=b},a.CanvasGraphics=function(){},a.CanvasGraphics.renderGraphics=function(b,c){for(var d=b.worldAlpha,e="",f=0;f1&&(d=1,window.console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object"));for(var e=0;1>e;e++){var f=b.graphicsData[e],g=f.points;if(f.type===a.Graphics.POLY){c.beginPath(),c.moveTo(g[0],g[1]);for(var h=1;hd;d++)this.children[d]._renderWebGL(b);b.spriteBatch.stop()}this._filters&&b.filterManager.popFilter(),this._mask&&b.maskManager.popMask(b),b.drawCount++,b.spriteBatch.start()}},a.Graphics.prototype._renderCanvas=function(b){if(this.visible!==!1&&0!==this.alpha&&this.isMask!==!0){var c=b.context,d=this.worldTransform;this.blendMode!==b.currentBlendMode&&(b.currentBlendMode=this.blendMode,c.globalCompositeOperation=a.blendModesCanvas[b.currentBlendMode]),c.setTransform(d.a,d.c,d.b,d.d,d.tx,d.ty),a.CanvasGraphics.renderGraphics(this,c);for(var e=0,f=this.children.length;f>e;e++)this.children[e]._renderCanvas(b)}},a.Graphics.prototype.getBounds=function(a){this.bounds||this.updateBounds();var b=this.bounds.x,c=this.bounds.width+this.bounds.x,d=this.bounds.y,e=this.bounds.height+this.bounds.y,f=a||this.worldTransform,g=f.a,h=f.c,i=f.b,j=f.d,k=f.tx,l=f.ty,m=g*c+i*e+k,n=j*e+h*c+l,o=g*b+i*e+k,p=j*e+h*b+l,q=g*b+i*d+k,r=j*d+h*b+l,s=g*c+i*d+k,t=j*d+h*c+l,u=-1/0,v=-1/0,w=1/0,x=1/0;w=w>m?m:w,w=w>o?o:w,w=w>q?q:w,w=w>s?s:w,x=x>n?n:x,x=x>p?p:x,x=x>r?r:x,x=x>t?t:x,u=m>u?m:u,u=o>u?o:u,u=q>u?q:u,u=s>u?s:u,v=n>v?n:v,v=p>v?p:v,v=r>v?r:v,v=t>v?t:v;var y=this._bounds;return y.x=w,y.width=u-w,y.y=x,y.height=v-x,y},a.Graphics.prototype.updateBounds=function(){for(var b,c,d,e,f,g=1/0,h=-1/0,i=1/0,j=-1/0,k=0;kc?c:g,h=c+e>h?c+e:h,i=i>d?c:i,j=d+f>j?d+f:j;else if(m===a.Graphics.CIRC||m===a.Graphics.ELIP)c=b[0],d=b[1],e=b[2]+n/2,f=b[3]+n/2,g=g>c-e?c-e:g,h=c+e>h?c+e:h,i=i>d-f?d-f:i,j=d+f>j?d+f:j;else for(var o=0;oc-n?c-n:g,h=c+n>h?c+n:h,i=i>d-n?d-n:i,j=d+n>j?d+n:j}var p=this.boundsPadding;this.bounds=new a.Rectangle(g-p,i-p,h-g+2*p,j-i+2*p)},a.Graphics.prototype._generateCachedSprite=function(){var b=this.getLocalBounds();if(this._cachedSprite)this._cachedSprite.buffer.resize(b.width,b.height);else{var c=new a.CanvasBuffer(b.width,b.height),d=a.Texture.fromCanvas(c.canvas);this._cachedSprite=new a.Sprite(d),this._cachedSprite.buffer=c,this._cachedSprite.worldTransform=this.worldTransform}this._cachedSprite.anchor.x=-(b.x/b.width),this._cachedSprite.anchor.y=-(b.y/b.height),this._cachedSprite.buffer.context.translate(-b.x,-b.y),a.CanvasGraphics.renderGraphics(this,this._cachedSprite.buffer.context)},a.Graphics.prototype.destroyCachedSprite=function(){this._cachedSprite.texture.destroy(!0),this._cachedSprite=null},a.Graphics.POLY=0,a.Graphics.RECT=1,a.Graphics.CIRC=2,a.Graphics.ELIP=3,a.TilingSprite=function(b,c,d){a.Sprite.call(this,b),this.width=c||100,this.height=d||100,this.tileScale=new a.Point(1,1),this.tileScaleOffset=new a.Point(1,1),this.tilePosition=new a.Point(0,0),this.renderable=!0,this.tint=16777215,this.blendMode=a.blendModes.NORMAL},a.TilingSprite.prototype=Object.create(a.Sprite.prototype),a.TilingSprite.prototype.constructor=a.TilingSprite,Object.defineProperty(a.TilingSprite.prototype,"width",{get:function(){return this._width},set:function(a){this._width=a}}),Object.defineProperty(a.TilingSprite.prototype,"height",{get:function(){return this._height},set:function(a){this._height=a}}),a.TilingSprite.prototype.onTextureUpdate=function(){this.updateFrame=!0},a.TilingSprite.prototype.setTexture=function(a){this.texture!==a&&(this.texture=a,this.refreshTexture=!0,this.cachedTint=16777215)},a.TilingSprite.prototype._renderWebGL=function(b){if(this.visible!==!1&&0!==this.alpha){var c,d;if(this.mask||this.filters){for(this.mask&&(b.spriteBatch.stop(),b.maskManager.pushMask(this.mask,b),b.spriteBatch.start()),this.filters&&(b.spriteBatch.flush(),b.filterManager.pushFilter(this._filterBlock)),!this.tilingTexture||this.refreshTexture?this.generateTilingTexture(!0):b.spriteBatch.renderTilingSprite(this),c=0,d=this.children.length;d>c;c++)this.children[c]._renderWebGL(b);b.spriteBatch.stop(),this.filters&&b.filterManager.popFilter(),this.mask&&b.maskManager.popMask(b),b.spriteBatch.start()}else for(!this.tilingTexture||this.refreshTexture?(this.generateTilingTexture(!0),this.tilingTexture.needsUpdate&&(a.updateWebGLTexture(this.tilingTexture.baseTexture,b.gl),this.tilingTexture.needsUpdate=!1)):b.spriteBatch.renderTilingSprite(this),c=0,d=this.children.length;d>c;c++)this.children[c]._renderWebGL(b)}},a.TilingSprite.prototype._renderCanvas=function(b){if(this.visible!==!1&&0!==this.alpha){var c=b.context;this._mask&&b.maskManager.pushMask(this._mask,c),c.globalAlpha=this.worldAlpha;var d=this.worldTransform;c.setTransform(d.a,d.c,d.b,d.d,d.tx,d.ty),(!this.__tilePattern||this.refreshTexture)&&(this.generateTilingTexture(!1),this.tilingTexture&&(this.__tilePattern=c.createPattern(this.tilingTexture.baseTexture.source,"repeat"))),this.blendMode!==b.currentBlendMode&&(b.currentBlendMode=this.blendMode,c.globalCompositeOperation=a.blendModesCanvas[b.currentBlendMode]),c.beginPath();var e=this.tilePosition,f=this.tileScale;e.x%=this.tilingTexture.baseTexture.width,e.y%=this.tilingTexture.baseTexture.height,c.scale(f.x,f.y),c.translate(e.x,e.y),c.fillStyle=this.__tilePattern,c.fillRect(-e.x,-e.y,this.width/f.x,this.height/f.y),c.scale(1/f.x,1/f.y),c.translate(-e.x,-e.y),c.closePath(),this._mask&&b.maskManager.popMask(b.context)}},a.TilingSprite.prototype.getBounds=function(){var a=this._width,b=this._height,c=a*(1-this.anchor.x),d=a*-this.anchor.x,e=b*(1-this.anchor.y),f=b*-this.anchor.y,g=this.worldTransform,h=g.a,i=g.c,j=g.b,k=g.d,l=g.tx,m=g.ty,n=h*d+j*f+l,o=k*f+i*d+m,p=h*c+j*f+l,q=k*f+i*c+m,r=h*c+j*e+l,s=k*e+i*c+m,t=h*d+j*e+l,u=k*e+i*d+m,v=-1/0,w=-1/0,x=1/0,y=1/0;x=x>n?n:x,x=x>p?p:x,x=x>r?r:x,x=x>t?t:x,y=y>o?o:y,y=y>q?q:y,y=y>s?s:y,y=y>u?u:y,v=n>v?n:v,v=p>v?p:v,v=r>v?r:v,v=t>v?t:v,w=o>w?o:w,w=q>w?q:w,w=s>w?s:w,w=u>w?u:w;var z=this._bounds;return z.x=x,z.width=v-x,z.y=y,z.height=w-y,this._currentBounds=z,z +},a.TilingSprite.prototype.generateTilingTexture=function(b){var c=this.texture;if(c.baseTexture.hasLoaded){var d,e,f=c.baseTexture,g=c.frame,h=g.width!==f.width||g.height!==f.height,i=!1;if(b?(d=a.getNextPowerOfTwo(g.width),e=a.getNextPowerOfTwo(g.height),g.width!==d&&g.height!==e&&(i=!0)):h&&(c.trim?(d=c.trim.width,e=c.trim.height):(d=g.width,e=g.height),i=!0),i){var j;this.tilingTexture&&this.tilingTexture.isTiling?(j=this.tilingTexture.canvasBuffer,j.resize(d,e),this.tilingTexture.baseTexture.width=d,this.tilingTexture.baseTexture.height=e,this.tilingTexture.needsUpdate=!0):(j=new a.CanvasBuffer(d,e),this.tilingTexture=a.Texture.fromCanvas(j.canvas),this.tilingTexture.canvasBuffer=j,this.tilingTexture.isTiling=!0),j.context.drawImage(c.baseTexture.source,g.x,g.y,g.width,g.height,0,0,d,e),this.tileScaleOffset.x=g.width/d,this.tileScaleOffset.y=g.height/e}else this.tilingTexture&&this.tilingTexture.isTiling&&this.tilingTexture.destroy(!0),this.tileScaleOffset.x=1,this.tileScaleOffset.y=1,this.tilingTexture=c;this.refreshTexture=!1,this.tilingTexture.baseTexture._powerOf2=!0}},a.BaseTextureCache={},a.texturesToUpdate=[],a.texturesToDestroy=[],a.BaseTextureCacheIdGenerator=0,a.BaseTexture=function(b,c){if(a.EventTarget.call(this),this.width=100,this.height=100,this.scaleMode=c||a.scaleModes.DEFAULT,this.hasLoaded=!1,this.source=b,this.id=a.BaseTextureCacheIdGenerator++,this._glTextures=[],b){if(this.source.complete||this.source.getContext)this.hasLoaded=!0,this.width=this.source.width,this.height=this.source.height,a.texturesToUpdate.push(this);else{var d=this;this.source.onload=function(){d.hasLoaded=!0,d.width=d.source.width,d.height=d.source.height,a.texturesToUpdate.push(d),d.dispatchEvent({type:"loaded",content:d})}}this.imageUrl=null,this._powerOf2=!1}},a.BaseTexture.prototype.constructor=a.BaseTexture,a.BaseTexture.prototype.destroy=function(){this.imageUrl&&(delete a.BaseTextureCache[this.imageUrl],this.imageUrl=null,this.source.src=null),this.source=null,a.texturesToDestroy.push(this)},a.BaseTexture.prototype.updateSourceImage=function(a){this.hasLoaded=!1,this.source.src=null,this.source.src=a},a.BaseTexture.fromImage=function(b,c,d){var e=a.BaseTextureCache[b];if(c=!c,!e){var f=new Image;c&&(f.crossOrigin=""),f.src=b,e=new a.BaseTexture(f,d),e.imageUrl=b,a.BaseTextureCache[b]=e}return e},a.BaseTexture.fromCanvas=function(b,c){b._pixiId||(b._pixiId="canvas_"+a.TextureCacheIdGenerator++);var d=a.BaseTextureCache[b._pixiId];return d||(d=new a.BaseTexture(b,c),a.BaseTextureCache[b._pixiId]=d),d},a.TextureCache={},a.FrameCache={},a.TextureCacheIdGenerator=0,a.Texture=function(b,c){if(a.EventTarget.call(this),c||(this.noFrame=!0,c=new a.Rectangle(0,0,1,1)),b instanceof a.Texture&&(b=b.baseTexture),this.baseTexture=b,this.frame=c,this.trim=null,this.scope=this,this._uvs=null,b.hasLoaded)this.noFrame&&(c=new a.Rectangle(0,0,b.width,b.height)),this.setFrame(c);else{var d=this;b.addEventListener("loaded",function(){d.onBaseTextureLoaded()})}},a.Texture.prototype.constructor=a.Texture,a.Texture.prototype.onBaseTextureLoaded=function(){var b=this.baseTexture;b.removeEventListener("loaded",this.onLoaded),this.noFrame&&(this.frame=new a.Rectangle(0,0,b.width,b.height)),this.setFrame(this.frame),this.scope.dispatchEvent({type:"update",content:this})},a.Texture.prototype.destroy=function(a){a&&this.baseTexture.destroy()},a.Texture.prototype.setFrame=function(b){if(this.frame=b,this.width=b.width,this.height=b.height,b.x+b.width>this.baseTexture.width||b.y+b.height>this.baseTexture.height)throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.updateFrame=!0,a.Texture.frameUpdates.push(this)},a.Texture.prototype._updateWebGLuvs=function(){this._uvs||(this._uvs=new a.TextureUvs);var b=this.frame,c=this.baseTexture.width,d=this.baseTexture.height;this._uvs.x0=b.x/c,this._uvs.y0=b.y/d,this._uvs.x1=(b.x+b.width)/c,this._uvs.y1=b.y/d,this._uvs.x2=(b.x+b.width)/c,this._uvs.y2=(b.y+b.height)/d,this._uvs.x3=b.x/c,this._uvs.y3=(b.y+b.height)/d},a.Texture.fromImage=function(b,c,d){var e=a.TextureCache[b];return e||(e=new a.Texture(a.BaseTexture.fromImage(b,c,d)),a.TextureCache[b]=e),e},a.Texture.fromFrame=function(b){var c=a.TextureCache[b];if(!c)throw new Error('The frameId "'+b+'" does not exist in the texture cache ');return c},a.Texture.fromCanvas=function(b,c){var d=a.BaseTexture.fromCanvas(b,c);return new a.Texture(d)},a.Texture.addTextureToCache=function(b,c){a.TextureCache[c]=b},a.Texture.removeTextureFromCache=function(b){var c=a.TextureCache[b];return delete a.TextureCache[b],delete a.BaseTextureCache[b],c},a.Texture.frameUpdates=[],a.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y4=0},a.RenderTexture=function(b,c,d){if(a.EventTarget.call(this),this.width=b||100,this.height=c||100,this.frame=new a.Rectangle(0,0,this.width,this.height),this.baseTexture=new a.BaseTexture,this.baseTexture.width=this.width,this.baseTexture.height=this.height,this.baseTexture._glTextures=[],this.baseTexture.hasLoaded=!0,this.renderer=d||a.defaultRenderer,this.renderer.type===a.WEBGL_RENDERER){var e=this.renderer.gl;this.textureBuffer=new a.FilterTexture(e,this.width,this.height),this.baseTexture._glTextures[e.id]=this.textureBuffer.texture,this.render=this.renderWebGL,this.projection=new a.Point(this.width/2,-this.height/2)}else this.render=this.renderCanvas,this.textureBuffer=new a.CanvasBuffer(this.width,this.height),this.baseTexture.source=this.textureBuffer.canvas;a.Texture.frameUpdates.push(this)},a.RenderTexture.prototype=Object.create(a.Texture.prototype),a.RenderTexture.prototype.constructor=a.RenderTexture,a.RenderTexture.prototype.resize=function(b,c){if(this.width=b,this.height=c,this.frame.width=this.width,this.frame.height=this.height,this.renderer.type===a.WEBGL_RENDERER){this.projection.x=this.width/2,this.projection.y=-this.height/2;var d=this.renderer.gl;d.bindTexture(d.TEXTURE_2D,this.baseTexture._glTextures[d.id]),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,this.width,this.height,0,d.RGBA,d.UNSIGNED_BYTE,null)}else this.textureBuffer.resize(this.width,this.height);a.Texture.frameUpdates.push(this)},a.RenderTexture.prototype.renderWebGL=function(b,c,d){var e=this.renderer.gl;e.colorMask(!0,!0,!0,!0),e.viewport(0,0,this.width,this.height),e.bindFramebuffer(e.FRAMEBUFFER,this.textureBuffer.frameBuffer),d&&this.textureBuffer.clear();var f=b.children,g=b.worldTransform;b.worldTransform=a.RenderTexture.tempMatrix,b.worldTransform.d=-1,b.worldTransform.ty=-2*this.projection.y,c&&(b.worldTransform.tx=c.x,b.worldTransform.ty-=c.y);for(var h=0,i=f.length;i>h;h++)f[h].updateTransform();a.WebGLRenderer.updateTextures(),this.renderer.renderDisplayObject(b,this.projection,this.textureBuffer.frameBuffer),b.worldTransform=g},a.RenderTexture.prototype.renderCanvas=function(b,c,d){var e=b.children,f=b.worldTransform;b.worldTransform=a.RenderTexture.tempMatrix,c&&(b.worldTransform.tx=c.x,b.worldTransform.ty=c.y);for(var g=0,h=e.length;h>g;g++)e[g].updateTransform();d&&this.textureBuffer.clear();var i=this.textureBuffer.context;this.renderer.renderDisplayObject(b,i),i.setTransform(1,0,0,1,0,0),b.worldTransform=f},a.RenderTexture.tempMatrix=new a.Matrix,b.Camera=function(a,c,d,e,f,g){this.game=a,this.world=a.world,this.id=0,this.view=new b.Rectangle(d,e,f,g),this.screenView=new b.Rectangle(d,e,f,g),this.bounds=new b.Rectangle(d,e,f,g),this.deadzone=null,this.visible=!0,this.atLimit={x:!1,y:!1},this.target=null,this._edge=0,this.displayObject=null},b.Camera.FOLLOW_LOCKON=0,b.Camera.FOLLOW_PLATFORMER=1,b.Camera.FOLLOW_TOPDOWN=2,b.Camera.FOLLOW_TOPDOWN_TIGHT=3,b.Camera.prototype={follow:function(a,c){"undefined"==typeof c&&(c=b.Camera.FOLLOW_LOCKON),this.target=a;var d;switch(c){case b.Camera.FOLLOW_PLATFORMER:var e=this.width/8,f=this.height/3;this.deadzone=new b.Rectangle((this.width-e)/2,(this.height-f)/2-.25*f,e,f);break;case b.Camera.FOLLOW_TOPDOWN:d=Math.max(this.width,this.height)/4,this.deadzone=new b.Rectangle((this.width-d)/2,(this.height-d)/2,d,d);break;case b.Camera.FOLLOW_TOPDOWN_TIGHT:d=Math.max(this.width,this.height)/8,this.deadzone=new b.Rectangle((this.width-d)/2,(this.height-d)/2,d,d);break;case b.Camera.FOLLOW_LOCKON:this.deadzone=null;break;default:this.deadzone=null}},focusOn:function(a){this.setPosition(Math.round(a.x-this.view.halfWidth),Math.round(a.y-this.view.halfHeight))},focusOnXY:function(a,b){this.setPosition(Math.round(a-this.view.halfWidth),Math.round(b-this.view.halfHeight))},update:function(){this.target&&this.updateTarget(),this.bounds&&this.checkBounds(),this.displayObject.position.x=-this.view.x,this.displayObject.position.y=-this.view.y},updateTarget:function(){this.deadzone?(this._edge=this.target.x-this.deadzone.x,this.view.x>this._edge&&(this.view.x=this._edge),this._edge=this.target.x+this.target.width-this.deadzone.x-this.deadzone.width,this.view.xthis._edge&&(this.view.y=this._edge),this._edge=this.target.y+this.target.height-this.deadzone.y-this.deadzone.height,this.view.ythis.bounds.right&&(this.atLimit.x=!0,this.view.x=this.bounds.right-this.width),this.view.ythis.bounds.bottom&&(this.atLimit.y=!0,this.view.y=this.bounds.bottom-this.height),this.view.floor()},setPosition:function(a,b){this.view.x=a,this.view.y=b,this.bounds&&this.checkBounds()},setSize:function(a,b){this.view.width=a,this.view.height=b},reset:function(){this.target=null,this.view.x=0,this.view.y=0}},b.Camera.prototype.constructor=b.Camera,Object.defineProperty(b.Camera.prototype,"x",{get:function(){return this.view.x},set:function(a){this.view.x=a,this.bounds&&this.checkBounds()}}),Object.defineProperty(b.Camera.prototype,"y",{get:function(){return this.view.y},set:function(a){this.view.y=a,this.bounds&&this.checkBounds()}}),Object.defineProperty(b.Camera.prototype,"width",{get:function(){return this.view.width},set:function(a){this.view.width=a}}),Object.defineProperty(b.Camera.prototype,"height",{get:function(){return this.view.height},set:function(a){this.view.height=a}}),b.State=function(){this.game=null,this.add=null,this.camera=null,this.cache=null,this.input=null,this.load=null,this.math=null,this.sound=null,this.stage=null,this.time=null,this.tweens=null,this.world=null,this.particles=null,this.physics=null},b.State.prototype={preload:function(){},loadUpdate:function(){},loadRender:function(){},create:function(){},update:function(){},render:function(){},paused:function(){},destroy:function(){}},b.State.prototype.constructor=b.State,b.StateManager=function(a,b){this.game=a,this.states={},this._pendingState=null,"undefined"!=typeof b&&null!==b&&(this._pendingState=b),this._created=!1,this.current="",this.onInitCallback=null,this.onPreloadCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onRenderCallback=null,this.onPreRenderCallback=null,this.onLoadUpdateCallback=null,this.onLoadRenderCallback=null,this.onPausedCallback=null,this.onShutDownCallback=null},b.StateManager.prototype={boot:function(){this.game.onPause.add(this.pause,this),this.game.onResume.add(this.resume,this),null!==this._pendingState&&("string"==typeof this._pendingState?this.start(this._pendingState,!1,!1):this.add("default",this._pendingState,!0))},add:function(a,c,d){"undefined"==typeof d&&(d=!1);var e;return c instanceof b.State?e=c:"object"==typeof c?(e=c,e.game=this.game):"function"==typeof c&&(e=new c(this.game)),this.states[a]=e,d&&(this.game.isBooted?this.start(a):this._pendingState=a),e},remove:function(a){this.current==a&&(this.callbackContext=null,this.onInitCallback=null,this.onShutDownCallback=null,this.onPreloadCallback=null,this.onLoadRenderCallback=null,this.onLoadUpdateCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onRenderCallback=null,this.onPausedCallback=null,this.onDestroyCallback=null),delete this.states[a]},start:function(a,b,c){return"undefined"==typeof b&&(b=!0),"undefined"==typeof c&&(c=!1),this.game.isBooted===!1?(this._pendingState=a,void 0):(this.checkState(a)!==!1&&(this.current&&this.onShutDownCallback.call(this.callbackContext,this.game),b&&(this.game.tweens.removeAll(),this.game.world.destroy(),c===!0&&this.game.cache.destroy()),this.setCurrentState(a),this.onPreloadCallback?(this.game.load.reset(),this.onPreloadCallback.call(this.callbackContext,this.game),0===this.game.load.totalQueuedFiles()?this.game.loadComplete():this.game.load.start()):this.game.loadComplete()),void 0)},dummy:function(){},checkState:function(a){if(this.states[a]){var b=!1;return this.states[a].preload&&(b=!0),b===!1&&this.states[a].loadRender&&(b=!0),b===!1&&this.states[a].loadUpdate&&(b=!0),b===!1&&this.states[a].create&&(b=!0),b===!1&&this.states[a].update&&(b=!0),b===!1&&this.states[a].preRender&&(b=!0),b===!1&&this.states[a].render&&(b=!0),b===!1&&this.states[a].paused&&(b=!0),b===!1?(console.warn("Invalid Phaser State object given. Must contain at least a one of the required functions."),!1):!0}return console.warn("Phaser.StateManager - No state found with the key: "+a),!1},link:function(a){this.states[a].game=this.game,this.states[a].add=this.game.add,this.states[a].camera=this.game.camera,this.states[a].cache=this.game.cache,this.states[a].input=this.game.input,this.states[a].load=this.game.load,this.states[a].math=this.game.math,this.states[a].sound=this.game.sound,this.states[a].scale=this.game.scale,this.states[a].stage=this.game.stage,this.states[a].time=this.game.time,this.states[a].tweens=this.game.tweens,this.states[a].world=this.game.world,this.states[a].particles=this.game.particles,this.states[a].physics=this.game.physics,this.states[a].rnd=this.game.rnd},setCurrentState:function(a){this.callbackContext=this.states[a],this.link(a),this.onInitCallback=this.states[a].init||this.dummy,this.onPreloadCallback=this.states[a].preload||null,this.onLoadRenderCallback=this.states[a].loadRender||null,this.onLoadUpdateCallback=this.states[a].loadUpdate||null,this.onCreateCallback=this.states[a].create||null,this.onUpdateCallback=this.states[a].update||null,this.onPreRenderCallback=this.states[a].preRender||null,this.onRenderCallback=this.states[a].render||null,this.onPausedCallback=this.states[a].paused||null,this.onShutDownCallback=this.states[a].shutdown||this.dummy,this.current=a,this._created=!1,this.onInitCallback.call(this.callbackContext,this.game)},getCurrentState:function(){return this.states[this.current]},loadComplete:function(){this._created===!1&&this.onCreateCallback?(this._created=!0,this.onCreateCallback.call(this.callbackContext,this.game)):this._created=!0},pause:function(){this._created&&this.onPausedCallback&&this.onPausedCallback.call(this.callbackContext,this.game,!0)},resume:function(){this._created&&this.onre&&this.onPausedCallback.call(this.callbackContext,this.game,!1)},update:function(){this._created&&this.onUpdateCallback?this.onUpdateCallback.call(this.callbackContext,this.game):this.onLoadUpdateCallback&&this.onLoadUpdateCallback.call(this.callbackContext,this.game)},preRender:function(){this.onPreRenderCallback&&this.onPreRenderCallback.call(this.callbackContext,this.game)},render:function(){this._created&&this.onRenderCallback?(this.game.renderType===b.CANVAS&&(this.game.context.save(),this.game.context.setTransform(1,0,0,1,0,0)),this.onRenderCallback.call(this.callbackContext,this.game),this.game.renderType===b.CANVAS&&this.game.context.restore()):this.onLoadRenderCallback&&this.onLoadRenderCallback.call(this.callbackContext,this.game)},destroy:function(){this.callbackContext=null,this.onInitCallback=null,this.onShutDownCallback=null,this.onPreloadCallback=null,this.onLoadRenderCallback=null,this.onLoadUpdateCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onRenderCallback=null,this.onPausedCallback=null,this.onDestroyCallback=null,this.game=null,this.states={},this._pendingState=null}},b.StateManager.prototype.constructor=b.StateManager,b.LinkedList=function(){this.next=null,this.prev=null,this.first=null,this.last=null,this.total=0},b.LinkedList.prototype={add:function(a){return 0===this.total&&null==this.first&&null==this.last?(this.first=a,this.last=a,this.next=a,a.prev=this,this.total++,a):(this.last.next=a,a.prev=this.last,this.last=a,this.total++,a)},remove:function(a){a==this.first?this.first=this.first.next:a==this.last&&(this.last=this.last.prev),a.prev&&(a.prev.next=a.next),a.next&&(a.next.prev=a.prev),a.next=a.prev=null,null==this.first&&(this.last=null),this.total--},callAll:function(a){if(this.first&&this.last){var b=this.first;do b&&b[a]&&b[a].call(b),b=b.next;while(b!=this.last.next)}}},b.LinkedList.prototype.constructor=b.LinkedList,b.Signal=function(){this._bindings=[],this._prevParams=null;var a=this;this.dispatch=function(){b.Signal.prototype.dispatch.apply(a,arguments)}},b.Signal.prototype={memorize:!1,_shouldPropagate:!0,active:!0,validateListener:function(a,b){if("function"!=typeof a)throw new Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",b))},_registerListener:function(a,c,d,e){var f,g=this._indexOfListener(a,d);if(-1!==g){if(f=this._bindings[g],f.isOnce()!==c)throw new Error("You cannot add"+(c?"":"Once")+"() then add"+(c?"Once":"")+"() the same listener without removing the relationship first.")}else f=new b.SignalBinding(this,a,c,d,e),this._addBinding(f);return this.memorize&&this._prevParams&&f.execute(this._prevParams),f},_addBinding:function(a){var b=this._bindings.length;do--b;while(this._bindings[b]&&a._priority<=this._bindings[b]._priority);this._bindings.splice(b+1,0,a)},_indexOfListener:function(a,b){for(var c,d=this._bindings.length;d--;)if(c=this._bindings[d],c._listener===a&&c.context===b)return d;return-1},has:function(a,b){return-1!==this._indexOfListener(a,b)},add:function(a,b,c){return this.validateListener(a,"add"),this._registerListener(a,!1,b,c)},addOnce:function(a,b,c){return this.validateListener(a,"addOnce"),this._registerListener(a,!0,b,c)},remove:function(a,b){this.validateListener(a,"remove");var c=this._indexOfListener(a,b);return-1!==c&&(this._bindings[c]._destroy(),this._bindings.splice(c,1)),a},removeAll:function(){for(var a=this._bindings.length;a--;)this._bindings[a]._destroy();this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(){if(this.active){var a,b=Array.prototype.slice.call(arguments),c=this._bindings.length;if(this.memorize&&(this._prevParams=b),c){a=this._bindings.slice(),this._shouldPropagate=!0;do c--;while(a[c]&&this._shouldPropagate&&a[c].execute(b)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),delete this._bindings,delete this._prevParams},toString:function(){return"[Phaser.Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}},b.Signal.prototype.constructor=b.Signal,b.SignalBinding=function(a,b,c,d,e){this._listener=b,this._isOnce=c,this.context=d,this._signal=a,this._priority=e||0},b.SignalBinding.prototype={active:!0,params:null,execute:function(a){var b,c;return this.active&&this._listener&&(c=this.params?this.params.concat(a):a,b=this._listener.apply(this.context,c),this._isOnce&&this.detach()),b},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return"[Phaser.SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},b.SignalBinding.prototype.constructor=b.SignalBinding,b.Filter=function(a,c,d){this.game=a,this.type=b.WEBGL_FILTER,this.passes=[this],this.shaders=[],this.dirty=!0,this.padding=0,this.uniforms={time:{type:"1f",value:0},resolution:{type:"2f",value:{x:256,y:256}},mouse:{type:"2f",value:{x:0,y:0}}},this.fragmentSrc=d||[]},b.Filter.prototype={init:function(){},setResolution:function(a,b){this.uniforms.resolution.value.x=a,this.uniforms.resolution.value.y=b},update:function(a){"undefined"!=typeof a&&(a.x>0&&(this.uniforms.mouse.x=a.x.toFixed(2)),a.y>0&&(this.uniforms.mouse.y=a.y.toFixed(2))),this.uniforms.time.value=this.game.time.totalElapsedSeconds()},destroy:function(){this.game=null}},b.Filter.prototype.constructor=b.Filter,Object.defineProperty(b.Filter.prototype,"width",{get:function(){return this.uniforms.resolution.value.x},set:function(a){this.uniforms.resolution.value.x=a}}),Object.defineProperty(b.Filter.prototype,"height",{get:function(){return this.uniforms.resolution.value.y},set:function(a){this.uniforms.resolution.value.y=a}}),b.Plugin=function(a,b){"undefined"==typeof b&&(b=null),this.game=a,this.parent=b,this.active=!1,this.visible=!1,this.hasPreUpdate=!1,this.hasUpdate=!1,this.hasPostUpdate=!1,this.hasRender=!1,this.hasPostRender=!1},b.Plugin.prototype={preUpdate:function(){},update:function(){},render:function(){},postRender:function(){},destroy:function(){this.game=null,this.parent=null,this.active=!1,this.visible=!1}},b.Plugin.prototype.constructor=b.Plugin,b.PluginManager=function(a,b){this.game=a,this._parent=b,this.plugins=[],this._pluginsLength=0},b.PluginManager.prototype={add:function(a){var b=!1;return"function"==typeof a?a=new a(this.game,this._parent):(a.game=this.game,a.parent=this._parent),"function"==typeof a.preUpdate&&(a.hasPreUpdate=!0,b=!0),"function"==typeof a.update&&(a.hasUpdate=!0,b=!0),"function"==typeof a.postUpdate&&(a.hasPostUpdate=!0,b=!0),"function"==typeof a.render&&(a.hasRender=!0,b=!0),"function"==typeof a.postRender&&(a.hasPostRender=!0,b=!0),b?((a.hasPreUpdate||a.hasUpdate||a.hasPostUpdate)&&(a.active=!0),(a.hasRender||a.hasPostRender)&&(a.visible=!0),this._pluginsLength=this.plugins.push(a),"function"==typeof a.init&&a.init(),a):null},remove:function(a){if(0!==this._pluginsLength)for(this._p=0;this._pthis._nextOffsetCheck&&(b.Canvas.getOffset(this.game.canvas,this.offset),this._nextOffsetCheck=this.game.time.now+this.checkOffsetInterval)},b.Stage.prototype.visibilityChange=function(a){this.disableVisibilityChange||(this.game.paused=this.game.paused!==!1||"pagehide"!=a.type&&"blur"!=a.type&&document.hidden!==!0&&document.webkitHidden!==!0?!1:!0)},b.Stage.prototype.setBackgroundColor=function(b){this._backgroundColor=b||0,this.backgroundColorSplit=a.hex2rgb(this.backgroundColor);var c=this._backgroundColor.toString(16);c="000000".substr(0,6-c.length)+c,this.backgroundColorString="#"+c},Object.defineProperty(b.Stage.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(a){this._backgroundColor=a,this.game.transparent===!1&&("string"==typeof a&&(a=b.Color.hexToRGB(a)),this.setBackgroundColor(a))}}),b.Group=function(c,d,e,f){this.game=c,("undefined"==typeof d||null===d)&&(d=c.world),this.name=e||"group",a.DisplayObjectContainer.call(this),"undefined"==typeof f||f===!1?d?d.addChild(this):this.game.stage.addChild(this):this.game.stage.addChild(this),this.type=b.GROUP,this.alive=!0,this.exists=!0,this.scale=new b.Point(1,1),this.cursor=null,this._cursorIndex=0,this.cameraOffset=new b.Point,this._cache=new Int16Array([0,0,0,0,1,0,1,0])},b.Group.prototype=Object.create(a.DisplayObjectContainer.prototype),b.Group.prototype.constructor=b.Group,b.Group.RETURN_NONE=0,b.Group.RETURN_TOTAL=1,b.Group.RETURN_CHILD=2,b.Group.SORT_ASCENDING=-1,b.Group.SORT_DESCENDING=1,b.Group.prototype.add=function(a){return a.parent!==this&&(this.addChild(a),a.events&&a.events.onAddedToGroup.dispatch(a,this)),null===this.cursor&&(this.cursor=a),a},b.Group.prototype.addAt=function(a,b){return a.parent!==this&&(this.addChildAt(a,b),a.events&&a.events.onAddedToGroup.dispatch(a,this)),null===this.cursor&&(this.cursor=a),a},b.Group.prototype.getAt=function(a){return this.getChildAt(a)},b.Group.prototype.create=function(a,c,d,e,f){"undefined"==typeof f&&(f=!0);var g=new b.Sprite(this.game,a,c,d,e);return g.exists=f,g.visible=f,g.alive=f,this.addChild(g),g.events&&g.events.onAddedToGroup.dispatch(g,this),null===this.cursor&&(this.cursor=g),g},b.Group.prototype.createMultiple=function(a,b,c,d){"undefined"==typeof d&&(d=!1);for(var e=0;a>e;e++)this.create(0,0,b,c,d)},b.Group.prototype.next=function(){this.cursor&&(this._cursorIndex===this.children.length?this._cursorIndex=0:this._cursorIndex++,this.cursor=this.children[this._cursorIndex])},b.Group.prototype.previous=function(){this.cursor&&(0===this._cursorIndex?this._cursorIndex=this.children.length-1:this._cursorIndex--,this.cursor=this.children[this._cursorIndex])},b.Group.prototype.swap=function(a,b){return this.swapChildren(a,b)},b.Group.prototype.bringToTop=function(a){return a.parent===this&&(this.remove(a),this.add(a)),a},b.Group.prototype.getIndex=function(a){return this.children.indexOf(a)},b.Group.prototype.replace=function(a,b){var c=this.getIndex(a);-1!==c&&(void 0!==b.parent&&(b.events.onRemovedFromGroup.dispatch(b,this),b.parent.removeChild(b)),this.removeChild(a),this.addChildAt(b,c),b.events.onAddedToGroup.dispatch(b,this),this.cursor===a&&(this.cursor=b))},b.Group.prototype.setProperty=function(a,b,c,d){d=d||0;var e=b.length;1==e?0===d?a[b[0]]=c:1==d?a[b[0]]+=c:2==d?a[b[0]]-=c:3==d?a[b[0]]*=c:4==d&&(a[b[0]]/=c):2==e?0===d?a[b[0]][b[1]]=c:1==d?a[b[0]][b[1]]+=c:2==d?a[b[0]][b[1]]-=c:3==d?a[b[0]][b[1]]*=c:4==d&&(a[b[0]][b[1]]/=c):3==e?0===d?a[b[0]][b[1]][b[2]]=c:1==d?a[b[0]][b[1]][b[2]]+=c:2==d?a[b[0]][b[1]][b[2]]-=c:3==d?a[b[0]][b[1]][b[2]]*=c:4==d&&(a[b[0]][b[1]][b[2]]/=c):4==e&&(0===d?a[b[0]][b[1]][b[2]][b[3]]=c:1==d?a[b[0]][b[1]][b[2]][b[3]]+=c:2==d?a[b[0]][b[1]][b[2]][b[3]]-=c:3==d?a[b[0]][b[1]][b[2]][b[3]]*=c:4==d&&(a[b[0]][b[1]][b[2]][b[3]]/=c))},b.Group.prototype.set=function(a,b,c,d,e,f){b=b.split("."),"undefined"==typeof d&&(d=!1),"undefined"==typeof e&&(e=!1),(d===!1||d&&a.alive)&&(e===!1||e&&a.visible)&&this.setProperty(a,b,c,f)},b.Group.prototype.setAll=function(a,b,c,d,e){a=a.split("."),"undefined"==typeof c&&(c=!1),"undefined"==typeof d&&(d=!1),e=e||0;for(var f=0,g=this.children.length;g>f;f++)(!c||c&&this.children[f].alive)&&(!d||d&&this.children[f].visible)&&this.setProperty(this.children[f],a,b,e)},b.Group.prototype.addAll=function(a,b,c,d){this.setAll(a,b,c,d,1)},b.Group.prototype.subAll=function(a,b,c,d){this.setAll(a,b,c,d,2)},b.Group.prototype.multiplyAll=function(a,b,c,d){this.setAll(a,b,c,d,3)},b.Group.prototype.divideAll=function(a,b,c,d){this.setAll(a,b,c,d,4)},b.Group.prototype.callAllExists=function(a,b){for(var c=Array.prototype.splice.call(arguments,2),d=0,e=this.children.length;e>d;d++)this.children[d].exists===b&&this.children[d][a]&&this.children[d][a].apply(this.children[d],c)},b.Group.prototype.callbackFromArray=function(a,b,c){if(1==c){if(a[b[0]])return a[b[0]]}else if(2==c){if(a[b[0]][b[1]])return a[b[0]][b[1]]}else if(3==c){if(a[b[0]][b[1]][b[2]])return a[b[0]][b[1]][b[2]]}else if(4==c){if(a[b[0]][b[1]][b[2]][b[3]])return a[b[0]][b[1]][b[2]][b[3]]}else if(a[b])return a[b];return!1},b.Group.prototype.callAll=function(a,b){if("undefined"!=typeof a){a=a.split(".");var c=a.length;if("undefined"==typeof b)b=null;else if("string"==typeof b){b=b.split(".");var d=b.length}for(var e=Array.prototype.splice.call(arguments,2),f=null,g=null,h=0,i=this.children.length;i>h;h++)f=this.callbackFromArray(this.children[h],a,c),b&&f?(g=this.callbackFromArray(this.children[h],b,d),f&&f.apply(g,e)):f&&f.apply(this.children[h],e)}},b.Group.prototype.preUpdate=function(){if(!this.exists||!this.parent.exists)return this.renderOrderID=-1,!1; +for(var a=this.children.length;a--;)this.children[a].preUpdate();return!0},b.Group.prototype.update=function(){for(var a=this.children.length;a--;)this.children[a].update()},b.Group.prototype.postUpdate=function(){1===this._cache[7]&&(this.x=this.game.camera.view.x+this.cameraOffset.x,this.y=this.game.camera.view.y+this.cameraOffset.y);for(var a=this.children.length;a--;)this.children[a].postUpdate()},b.Group.prototype.forEach=function(a,b,c){"undefined"==typeof c&&(c=!1);var d=Array.prototype.splice.call(arguments,3);d.unshift(null);for(var e=0,f=this.children.length;f>e;e++)(!c||c&&this.children[e].exists)&&(d[0]=this.children[e],a.apply(b,d))},b.Group.prototype.forEachExists=function(a,c){var d=Array.prototype.splice.call(arguments,2);d.unshift(null),this.iterate("exists",!0,b.Group.RETURN_TOTAL,a,c,d)},b.Group.prototype.forEachAlive=function(a,c){var d=Array.prototype.splice.call(arguments,2);d.unshift(null),this.iterate("alive",!0,b.Group.RETURN_TOTAL,a,c,d)},b.Group.prototype.forEachDead=function(a,c){var d=Array.prototype.splice.call(arguments,2);d.unshift(null),this.iterate("alive",!1,b.Group.RETURN_TOTAL,a,c,d)},b.Group.prototype.sort=function(a,c){"undefined"==typeof a&&(a="y"),"undefined"==typeof c&&(c=b.Group.SORT_ASCENDING)},b.Group.prototype.sortHandler=function(){},b.Group.prototype.iterate=function(a,c,d,e,f,g){if(d===b.Group.RETURN_TOTAL&&0===this.children.length)return 0;"undefined"==typeof e&&(e=!1);for(var h=0,i=0,j=this.children.length;j>i;i++)if(this.children[i][a]===c&&(h++,e&&(g[0]=this.children[i],e.apply(f,g)),d===b.Group.RETURN_CHILD))return this.children[i];return d===b.Group.RETURN_TOTAL?h:d===b.Group.RETURN_CHILD?null:void 0},b.Group.prototype.getFirstExists=function(a){return"boolean"!=typeof a&&(a=!0),this.iterate("exists",a,b.Group.RETURN_CHILD)},b.Group.prototype.getFirstAlive=function(){return this.iterate("alive",!0,b.Group.RETURN_CHILD)},b.Group.prototype.getFirstDead=function(){return this.iterate("alive",!1,b.Group.RETURN_CHILD)},b.Group.prototype.countLiving=function(){return this.iterate("alive",!0,b.Group.RETURN_TOTAL)},b.Group.prototype.countDead=function(){return this.iterate("alive",!1,b.Group.RETURN_TOTAL)},b.Group.prototype.getRandom=function(a,b){return 0===this.children.length?null:(a=a||0,b=b||this.children.length,this.game.math.getRandom(this.children,a,b))},b.Group.prototype.remove=function(a){return 0!==this.children.length?(a.events&&a.events.onRemovedFromGroup.dispatch(a,this),this.removeChild(a),this.cursor===a&&this.next(),!0):void 0},b.Group.prototype.removeAll=function(){if(0!==this.children.length){do 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}},b.Group.prototype.removeBetween=function(a,b){if(0!==this.children.length){if(a>b||0>a||b>this.children.length)return!1;for(var c=a;b>c;c++)this.children[c].events&&this.children[c].events.onRemovedFromGroup.dispatch(this.children[c],this),this.removeChild(this.children[c]),this.cursor===child&&(this.cursor=null)}},b.Group.prototype.destroy=function(a){if("undefined"==typeof a&&(a=!1),a){if(this.children.length>0)do 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=!1,this.cursor=null},Object.defineProperty(b.Group.prototype,"total",{get:function(){return this.iterate("exists",!0,b.Group.RETURN_TOTAL)}}),Object.defineProperty(b.Group.prototype,"length",{get:function(){return this.children.length}}),Object.defineProperty(b.Group.prototype,"angle",{get:function(){return b.Math.radToDeg(this.rotation)},set:function(a){this.rotation=b.Math.degToRad(a)}}),Object.defineProperty(b.Group.prototype,"fixedToCamera",{get:function(){return!!this._cache[7]},set:function(a){a?(this._cache[7]=1,this.cameraOffset.set(this.x,this.y)):this._cache[7]=0}}),b.World=function(a){b.Group.call(this,a,null,"__world",!1),this.bounds=new b.Rectangle(0,0,a.width,a.height),this.camera=null,this.currentRenderOrderID=0},b.World.prototype=Object.create(b.Group.prototype),b.World.prototype.constructor=b.World,b.World.prototype.boot=function(){this.camera=new b.Camera(this.game,0,0,0,this.game.width,this.game.height),this.camera.displayObject=this,this.game.camera=this.camera,this.game.stage.addChild(this)},b.World.prototype.setBounds=function(a,b,c,d){c0;c--)null===this["pointer"+c]&&(a=c);return 0===a?(console.warn("You can only have 10 Pointer objects"),null):(this["pointer"+a]=new b.Pointer(this.game,a),this["pointer"+a])},update:function(){return this.pollRate>0&&this._pollCounter=c;c++)this["pointer"+c]&&this["pointer"+c].reset();this.currentPointers=0,"none"!==this.game.canvas.style.cursor&&(this.game.canvas.style.cursor="inherit"),a===!0&&(this.onDown.dispose(),this.onUp.dispose(),this.onTap.dispose(),this.onHold.dispose(),this.onDown=new b.Signal,this.onUp=new b.Signal,this.onTap=new b.Signal,this.onHold=new b.Signal,this.interactiveItems.callAll("reset")),this._pollCounter=0}},resetSpeed:function(a,b){this._oldPosition.setTo(a,b),this.speed.setTo(0,0)},startPointer:function(a){if(this.maxPointers<10&&this.totalActivePointers==this.maxPointers)return null;if(this.pointer1.active===!1)return this.pointer1.start(a);if(this.pointer2.active===!1)return this.pointer2.start(a);for(var b=3;10>=b;b++)if(this["pointer"+b]&&this["pointer"+b].active===!1)return this["pointer"+b].start(a);return null},updatePointer:function(a){if(this.pointer1.active&&this.pointer1.identifier==a.identifier)return this.pointer1.move(a);if(this.pointer2.active&&this.pointer2.identifier==a.identifier)return this.pointer2.move(a);for(var b=3;10>=b;b++)if(this["pointer"+b]&&this["pointer"+b].active&&this["pointer"+b].identifier==a.identifier)return this["pointer"+b].move(a);return null},stopPointer:function(a){if(this.pointer1.active&&this.pointer1.identifier==a.identifier)return this.pointer1.stop(a);if(this.pointer2.active&&this.pointer2.identifier==a.identifier)return this.pointer2.stop(a);for(var b=3;10>=b;b++)if(this["pointer"+b]&&this["pointer"+b].active&&this["pointer"+b].identifier==a.identifier)return this["pointer"+b].stop(a);return null},getPointer:function(a){if(a=a||!1,this.pointer1.active==a)return this.pointer1;if(this.pointer2.active==a)return this.pointer2;for(var b=3;10>=b;b++)if(this["pointer"+b]&&this["pointer"+b].active==a)return this["pointer"+b];return null},getPointerFromIdentifier:function(a){if(this.pointer1.identifier==a)return this.pointer1;if(this.pointer2.identifier==a)return this.pointer2;for(var b=3;10>=b;b++)if(this["pointer"+b]&&this["pointer"+b].identifier==a)return this["pointer"+b];return null},getLocalPosition:function(a,c,d){"undefined"==typeof d&&(d=new b.Point);var e=a.worldTransform,f=1/(e.a*e.d+e.b*-e.c);return d.setTo(e.d*f*c.x+-e.b*f*c.y+(e.ty*e.b-e.tx*e.d)*f,e.a*f*c.y+-e.c*f*c.x+(-e.ty*e.a+e.tx*e.c)*f)},hitTest:function(b,c,d){if(!b.worldVisible)return!1;if(this.getLocalPosition(b,c,this._localPoint),d.copyFrom(this._localPoint),b.hitArea&&b.hitArea.contains)return b.hitArea.contains(this._localPoint.x,this._localPoint.y)?!0:!1;if(b instanceof a.Sprite){var e=b.texture.frame.width,f=b.texture.frame.height,g=-e*b.anchor.x;if(this._localPoint.x>g&&this._localPoint.xh&&this._localPoint.yi;i++)if(this.hitTest(b.children[i],c,d))return!0;return!1}},b.Input.prototype.constructor=b.Input,Object.defineProperty(b.Input.prototype,"x",{get:function(){return this._x},set:function(a){this._x=Math.floor(a)}}),Object.defineProperty(b.Input.prototype,"y",{get:function(){return this._y},set:function(a){this._y=Math.floor(a)}}),Object.defineProperty(b.Input.prototype,"pollLocked",{get:function(){return this.pollRate>0&&this._pollCounter=a;a++)this["pointer"+a]&&this["pointer"+a].active&&this.currentPointers++;return this.currentPointers}}),Object.defineProperty(b.Input.prototype,"worldX",{get:function(){return this.game.camera.view.x+this.x}}),Object.defineProperty(b.Input.prototype,"worldY",{get:function(){return this.game.camera.view.y+this.y}}),b.Key=function(a,c){this.game=a,this.isDown=!1,this.isUp=!1,this.altKey=!1,this.ctrlKey=!1,this.shiftKey=!1,this.timeDown=0,this.duration=0,this.timeUp=0,this.repeats=0,this.keyCode=c,this.onDown=new b.Signal,this.onUp=new b.Signal},b.Key.prototype={processKeyDown:function(a){this.altKey=a.altKey,this.ctrlKey=a.ctrlKey,this.shiftKey=a.shiftKey,this.isDown?(this.duration=a.timeStamp-this.timeDown,this.repeats++):(this.isDown=!0,this.isUp=!1,this.timeDown=a.timeStamp,this.duration=0,this.repeats=0,this.onDown.dispatch(this))},processKeyUp:function(a){this.isDown=!1,this.isUp=!0,this.timeUp=a.timeStamp,this.onUp.dispatch(this)},justPressed:function(a){return"undefined"==typeof a&&(a=250),this.isDown&&this.duration=this.game.input.holdRate&&((this.game.input.multiInputOverride==b.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==b.Input.MOUSE_TOUCH_COMBINE||this.game.input.multiInputOverride==b.Input.TOUCH_OVERRIDES_MOUSE&&0===this.game.input.currentPointers)&&this.game.input.onHold.dispatch(this),this._holdSent=!0),this.game.input.recordPointerHistory&&this.game.time.now>=this._nextDrop&&(this._nextDrop=this.game.time.now+this.game.input.recordRate,this._history.push({x:this.position.x,y:this.position.y}),this._history.length>this.game.input.recordLimit&&this._history.shift())) +},move:function(a,c){if(!this.game.input.pollLocked){if("undefined"==typeof c&&(c=!1),"undefined"!=typeof a.button&&(this.button=a.button),this.clientX=a.clientX,this.clientY=a.clientY,this.pageX=a.pageX,this.pageY=a.pageY,this.screenX=a.screenX,this.screenY=a.screenY,this.x=(this.pageX-this.game.stage.offset.x)*this.game.input.scale.x,this.y=(this.pageY-this.game.stage.offset.y)*this.game.input.scale.y,this.position.setTo(this.x,this.y),this.circle.x=this.x,this.circle.y=this.y,(this.game.input.multiInputOverride==b.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==b.Input.MOUSE_TOUCH_COMBINE||this.game.input.multiInputOverride==b.Input.TOUCH_OVERRIDES_MOUSE&&0===this.game.input.currentPointers)&&(this.game.input.activePointer=this,this.game.input.x=this.x,this.game.input.y=this.y,this.game.input.position.setTo(this.game.input.x,this.game.input.y),this.game.input.circle.x=this.game.input.x,this.game.input.circle.y=this.game.input.y),this.game.paused)return this;if(this.game.input.moveCallback&&this.game.input.moveCallback.call(this.game.input.moveCallbackContext,this,this.x,this.y),null!==this.targetObject&&this.targetObject.isDragged===!0)return this.targetObject.update(this)===!1&&(this.targetObject=null),this;if(this._highestRenderOrderID=-1,this._highestRenderObject=null,this._highestInputPriorityID=-1,this.game.input.interactiveItems.total>0){var d=this.game.input.interactiveItems.next;do(d.pixelPerfectClick||d.pixelPerfectOver||d.priorityID>this._highestInputPriorityID||d.priorityID===this._highestInputPriorityID&&d.sprite.renderOrderID>this._highestRenderOrderID)&&(!c&&d.checkPointerOver(this)||c&&d.checkPointerDown(this))&&(this._highestRenderOrderID=d.sprite.renderOrderID,this._highestInputPriorityID=d.priorityID,this._highestRenderObject=d),d=d.next;while(null!=d)}return null===this._highestRenderObject?this.targetObject&&(this.targetObject._pointerOutHandler(this),this.targetObject=null):null===this.targetObject?(this.targetObject=this._highestRenderObject,this._highestRenderObject._pointerOverHandler(this)):this.targetObject===this._highestRenderObject?this._highestRenderObject.update(this)===!1&&(this.targetObject=null):(this.targetObject._pointerOutHandler(this),this.targetObject=this._highestRenderObject,this.targetObject._pointerOverHandler(this)),this}},leave:function(a){this.withinGame=!1,this.move(a,!1)},stop:function(a){if(this._stateReset)return a.preventDefault(),void 0;if(this.timeUp=this.game.time.now,(this.game.input.multiInputOverride==b.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==b.Input.MOUSE_TOUCH_COMBINE||this.game.input.multiInputOverride==b.Input.TOUCH_OVERRIDES_MOUSE&&0===this.game.input.currentPointers)&&(this.game.input.onUp.dispatch(this,a),this.duration>=0&&this.duration<=this.game.input.tapRate&&(this.timeUp-this.previousTapTime0&&(this.active=!1),this.withinGame=!1,this.isDown=!1,this.isUp=!0,this.isMouse===!1&&this.game.input.currentPointers--,this.game.input.interactiveItems.total>0){var c=this.game.input.interactiveItems.next;do c&&c._releasedHandler(this),c=c.next;while(null!=c)}return this.targetObject&&this.targetObject._releasedHandler(this),this.targetObject=null,this},justPressed:function(a){return a=a||this.game.input.justPressedRate,this.isDown===!0&&this.timeDown+a>this.game.time.now},justReleased:function(a){return a=a||this.game.input.justReleasedRate,this.isUp===!0&&this.timeUp+a>this.game.time.now},reset:function(){this.isMouse===!1&&(this.active=!1),this.identifier=null,this.isDown=!1,this.isUp=!0,this.totalTouches=0,this._holdSent=!1,this._history.length=0,this._stateReset=!0,this.targetObject&&this.targetObject._releasedHandler(this),this.targetObject=null}},b.Pointer.prototype.constructor=b.Pointer,Object.defineProperty(b.Pointer.prototype,"duration",{get:function(){return this.isUp?-1:this.game.time.now-this.timeDown}}),Object.defineProperty(b.Pointer.prototype,"worldX",{get:function(){return this.game.world.camera.x+this.x}}),Object.defineProperty(b.Pointer.prototype,"worldY",{get:function(){return this.game.world.camera.y+this.y}}),b.Touch=function(a){this.game=a,this.disabled=!1,this.callbackContext=this.game,this.touchStartCallback=null,this.touchMoveCallback=null,this.touchEndCallback=null,this.touchEnterCallback=null,this.touchLeaveCallback=null,this.touchCancelCallback=null,this.preventDefault=!0,this.event=null,this._onTouchStart=null,this._onTouchMove=null,this._onTouchEnd=null,this._onTouchEnter=null,this._onTouchLeave=null,this._onTouchCancel=null,this._onTouchMove=null},b.Touch.prototype={start:function(){var a=this;this.game.device.touch&&(this._onTouchStart=function(b){return a.onTouchStart(b)},this._onTouchMove=function(b){return a.onTouchMove(b)},this._onTouchEnd=function(b){return a.onTouchEnd(b)},this._onTouchEnter=function(b){return a.onTouchEnter(b)},this._onTouchLeave=function(b){return a.onTouchLeave(b)},this._onTouchCancel=function(b){return a.onTouchCancel(b)},this.game.renderer.view.addEventListener("touchstart",this._onTouchStart,!1),this.game.renderer.view.addEventListener("touchmove",this._onTouchMove,!1),this.game.renderer.view.addEventListener("touchend",this._onTouchEnd,!1),this.game.renderer.view.addEventListener("touchenter",this._onTouchEnter,!1),this.game.renderer.view.addEventListener("touchleave",this._onTouchLeave,!1),this.game.renderer.view.addEventListener("touchcancel",this._onTouchCancel,!1))},consumeDocumentTouches:function(){this._documentTouchMove=function(a){a.preventDefault()},document.addEventListener("touchmove",this._documentTouchMove,!1)},onTouchStart:function(a){if(this.event=a,this.touchStartCallback&&this.touchStartCallback.call(this.callbackContext,a),!this.game.input.disabled&&!this.disabled){this.preventDefault&&a.preventDefault();for(var b=0;b0&&e>this.deadZone||0>e&&e<-this.deadZone?this.processAxisChange({axis:d,value:e}):this.processAxisChange({axis:d,value:0})}this._prevTimestamp=this._rawPad.timestamp}},connect:function(a){var b=!this._connected;this._index=a.index,this._connected=!0,this._rawPad=a,this._rawButtons=a.buttons,this._axes=a.axes,b&&this._padParent.onConnectCallback&&this._padParent.onConnectCallback.call(this._padParent.callbackContext,this._index),b&&this.onConnectCallback&&this.onConnectCallback.call(this.callbackContext)},disconnect:function(){var a=this._connected;this._connected=!1,this._rawPad=void 0,this._rawButtons=[],this._buttons=[];var b=this._index;this._index=null,a&&this._padParent.onDisconnectCallback&&this._padParent.onDisconnectCallback.call(this._padParent.callbackContext,b),a&&this.onDisconnectCallback&&this.onDisconnectCallback.call(this.callbackContext)},processAxisChange:function(a){this.game.input.disabled||this.game.input.gamepad.disabled||this._axes[a.axis]!==a.value&&(this._axes[a.axis]=a.value,this._padParent.onAxisCallback&&this._padParent.onAxisCallback.call(this._padParent.callbackContext,a,this._index),this.onAxisCallback&&this.onAxisCallback.call(this.callbackContext,a))},processButtonDown:function(a,b){this.game.input.disabled||this.game.input.gamepad.disabled||(this._padParent.onDownCallback&&this._padParent.onDownCallback.call(this._padParent.callbackContext,a,b,this._index),this.onDownCallback&&this.onDownCallback.call(this.callbackContext,a,b),this._buttons[a]&&this._buttons[a].isDown?this._buttons[a].duration=this.game.time.now-this._buttons[a].timeDown:this._buttons[a]?(this._buttons[a].isDown=!0,this._buttons[a].timeDown=this.game.time.now,this._buttons[a].duration=0,this._buttons[a].value=b):this._buttons[a]={isDown:!0,timeDown:this.game.time.now,timeUp:0,duration:0,value:b},this._hotkeys[a]&&this._hotkeys[a].processButtonDown(b))},processButtonUp:function(a,b){this.game.input.disabled||this.game.input.gamepad.disabled||(this._padParent.onUpCallback&&this._padParent.onUpCallback.call(this._padParent.callbackContext,a,b,this._index),this.onUpCallback&&this.onUpCallback.call(this.callbackContext,a,b),this._hotkeys[a]&&this._hotkeys[a].processButtonUp(b),this._buttons[a]?(this._buttons[a].isDown=!1,this._buttons[a].timeUp=this.game.time.now,this._buttons[a].value=b):this._buttons[a]={isDown:!1,timeDown:this.game.time.now,timeUp:this.game.time.now,duration:0,value:b})},processButtonFloat:function(a,b){this.game.input.disabled||this.game.input.gamepad.disabled||(this._padParent.onFloatCallback&&this._padParent.onFloatCallback.call(this._padParent.callbackContext,a,b,this._index),this.onFloatCallback&&this.onFloatCallback.call(this.callbackContext,a,b),this._buttons[a]?this._buttons[a].value=b:this._buttons[a]={value:b},this._hotkeys[a]&&this._hotkeys[a].processButtonFloat(b))},axis:function(a){return this._axes[a]?this._axes[a]:!1},isDown:function(a){return this._buttons[a]?this._buttons[a].isDown:!1},justReleased:function(a,b){return"undefined"==typeof b&&(b=250),this._buttons[a]&&this._buttons[a].isDown===!1&&this.game.time.now-this._buttons[a].timeUpd;d++)this._pointerData[d]={id:d,x:0,y:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1};this.snapOffset=new b.Point,this.enabled=!0,this.sprite.events&&null===this.sprite.events.onInputOver&&(this.sprite.events.onInputOver=new b.Signal,this.sprite.events.onInputOut=new b.Signal,this.sprite.events.onInputDown=new b.Signal,this.sprite.events.onInputUp=new b.Signal,this.sprite.events.onDragStart=new b.Signal,this.sprite.events.onDragStop=new b.Signal)}return this.sprite},reset:function(){this.enabled=!1;for(var a=0;10>a;a++)this._pointerData[a]={id:a,x:0,y:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1}},stop:function(){this.enabled!==!1&&(this.enabled=!1,this.game.input.interactiveItems.remove(this))},destroy:function(){this.enabled&&(this.enabled=!1,this.game.input.interactiveItems.remove(this),this._pointerData.length=0,this.boundsRect=null,this.boundsSprite=null,this.sprite=null)},pointerX:function(a){return a=a||0,this._pointerData[a].x},pointerY:function(a){return a=a||0,this._pointerData[a].y},pointerDown:function(a){return a=a||0,this._pointerData[a].isDown},pointerUp:function(a){return a=a||0,this._pointerData[a].isUp},pointerTimeDown:function(a){return a=a||0,this._pointerData[a].timeDown},pointerTimeUp:function(a){return a=a||0,this._pointerData[a].timeUp},pointerOver:function(a){if(this.enabled){if("undefined"!=typeof a)return this._pointerData[a].isOver;for(var b=0;10>b;b++)if(this._pointerData[b].isOver)return!0}return!1},pointerOut:function(a){if(this.enabled){if("undefined"!=typeof a)return this._pointerData[a].isOut;for(var b=0;10>b;b++)if(this._pointerData[b].isOut)return!0}return!1},pointerTimeOver:function(a){return a=a||0,this._pointerData[a].timeOver},pointerTimeOut:function(a){return a=a||0,this._pointerData[a].timeOut},pointerDragged:function(a){return a=a||0,this._pointerData[a].isDragged},checkPointerDown:function(a){return this.enabled===!1||this.sprite.visible===!1||this.sprite.parent.visible===!1?!1:this.game.input.hitTest(this.sprite,a,this._tempPoint)?this.pixelPerfectClick?this.checkPixel(this._tempPoint.x,this._tempPoint.y):!0:!1},checkPointerOver:function(a){return this.enabled===!1||this.sprite.visible===!1||this.sprite.parent.visible===!1?!1:this.game.input.hitTest(this.sprite,a,this._tempPoint)?this.pixelPerfectOver?this.checkPixel(this._tempPoint.x,this._tempPoint.y):!0:!1},checkPixel:function(a,b,c){if(this.sprite.texture.baseTexture.source){if(this.game.input.hitContext.clearRect(0,0,1,1),null===a&&null===b){this.game.input.getLocalPosition(this.sprite,c,this._tempPoint);var a=this._tempPoint.x,b=this._tempPoint.y}0!==this.sprite.anchor.x&&(a-=-this.sprite.texture.frame.width*this.sprite.anchor.x),0!==this.sprite.anchor.y&&(b-=-this.sprite.texture.frame.height*this.sprite.anchor.y),a+=this.sprite.texture.frame.x,b+=this.sprite.texture.frame.y,this.game.input.hitContext.drawImage(this.sprite.texture.baseTexture.source,a,b,1,1,0,0,1,1);var d=this.game.input.hitContext.getImageData(0,0,1,1);if(d.data[3]>=this.pixelPerfectAlpha)return!0}return!1},update:function(a){return null!==this.sprite?this.enabled===!1||this.sprite.visible===!1||this.sprite.group&&this.sprite.group.visible===!1?(this._pointerOutHandler(a),!1):this.draggable&&this._draggedPointerID==a.id?this.updateDrag(a):this._pointerData[a.id].isOver===!0?this.checkPointerOver(a)?(this._pointerData[a.id].x=a.x-this.sprite.x,this._pointerData[a.id].y=a.y-this.sprite.y,!0):(this._pointerOutHandler(a),!1):void 0:void 0},_pointerOverHandler:function(a){null!==this.sprite&&this._pointerData[a.id].isOver===!1&&(this._pointerData[a.id].isOver=!0,this._pointerData[a.id].isOut=!1,this._pointerData[a.id].timeOver=this.game.time.now,this._pointerData[a.id].x=a.x-this.sprite.x,this._pointerData[a.id].y=a.y-this.sprite.y,this.useHandCursor&&this._pointerData[a.id].isDragged===!1&&(this.game.canvas.style.cursor="pointer"),this.sprite.events.onInputOver.dispatch(this.sprite,a))},_pointerOutHandler:function(a){null!==this.sprite&&(this._pointerData[a.id].isOver=!1,this._pointerData[a.id].isOut=!0,this._pointerData[a.id].timeOut=this.game.time.now,this.useHandCursor&&this._pointerData[a.id].isDragged===!1&&(this.game.canvas.style.cursor="default"),this.sprite&&this.sprite.events&&this.sprite.events.onInputOut.dispatch(this.sprite,a))},_touchedHandler:function(a){if(null!==this.sprite){if(this._pointerData[a.id].isDown===!1&&this._pointerData[a.id].isOver===!0){if(this.pixelPerfectClick&&!this.checkPixel(null,null,a))return;this._pointerData[a.id].isDown=!0,this._pointerData[a.id].isUp=!1,this._pointerData[a.id].timeDown=this.game.time.now,this.sprite.events.onInputDown.dispatch(this.sprite,a),this.draggable&&this.isDragged===!1&&this.startDrag(a),this.bringToTop&&this.sprite.bringToTop()}return this.consumePointerEvent}},_releasedHandler:function(a){null!==this.sprite&&this._pointerData[a.id].isDown&&a.isUp&&(this._pointerData[a.id].isDown=!1,this._pointerData[a.id].isUp=!0,this._pointerData[a.id].timeUp=this.game.time.now,this._pointerData[a.id].downDuration=this._pointerData[a.id].timeUp-this._pointerData[a.id].timeDown,this.checkPointerOver(a)?this.sprite.events.onInputUp.dispatch(this.sprite,a,!0):(this.sprite.events.onInputUp.dispatch(this.sprite,a,!1),this.useHandCursor&&(this.game.canvas.style.cursor="default")),this.draggable&&this.isDragged&&this._draggedPointerID==a.id&&this.stopDrag(a))},updateDrag:function(a){return a.isUp?(this.stopDrag(a),!1):(this.sprite.fixedToCamera?(this.allowHorizontalDrag&&(this.sprite.cameraOffset.x=a.x+this._dragPoint.x+this.dragOffset.x),this.allowVerticalDrag&&(this.sprite.cameraOffset.y=a.y+this._dragPoint.y+this.dragOffset.y),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(this.sprite.cameraOffset.x=Math.round((this.sprite.cameraOffset.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.cameraOffset.y=Math.round((this.sprite.cameraOffset.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY)):(this.allowHorizontalDrag&&(this.sprite.x=a.x+this._dragPoint.x+this.dragOffset.x),this.allowVerticalDrag&&(this.sprite.y=a.y+this._dragPoint.y+this.dragOffset.y),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(this.sprite.x=Math.round((this.sprite.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.y=Math.round((this.sprite.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY)),!0)},justOver:function(a,b){return a=a||0,b=b||500,this._pointerData[a].isOver&&this.overDuration(a)a;a++)this._pointerData[a].isDragged=!1;this.draggable=!1,this.isDragged=!1,this._draggedPointerID=-1},startDrag:function(a){this.isDragged=!0,this._draggedPointerID=a.id,this._pointerData[a.id].isDragged=!0,this.sprite.fixedToCamera?this.dragFromCenter?(this.sprite.centerOn(a.x,a.y),this._dragPoint.setTo(this.sprite.cameraOffset.x-a.x,this.sprite.cameraOffset.y-a.y)):this._dragPoint.setTo(this.sprite.cameraOffset.x-a.x,this.sprite.cameraOffset.y-a.y):this.dragFromCenter?(this.sprite.centerOn(a.x,a.y),this._dragPoint.setTo(this.sprite.x-a.x,this.sprite.y-a.y)):this._dragPoint.setTo(this.sprite.x-a.x,this.sprite.y-a.y),this.updateDrag(a),this.bringToTop&&this.sprite.bringToTop(),this.sprite.events.onDragStart.dispatch(this.sprite,a)},stopDrag:function(a){this.isDragged=!1,this._draggedPointerID=-1,this._pointerData[a.id].isDragged=!1,this.snapOnRelease&&(this.sprite.fixedToCamera?(this.sprite.cameraOffset.x=Math.round((this.sprite.cameraOffset.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.cameraOffset.y=Math.round((this.sprite.cameraOffset.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY):(this.sprite.x=Math.round((this.sprite.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,this.sprite.y=Math.round((this.sprite.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY)),this.sprite.events.onDragStop.dispatch(this.sprite,a),this.sprite.events.onInputUp.dispatch(this.sprite,a),this.checkPointerOver(a)===!1&&this._pointerOutHandler(a)},setDragLock:function(a,b){"undefined"==typeof a&&(a=!0),"undefined"==typeof b&&(b=!0),this.allowHorizontalDrag=a,this.allowVerticalDrag=b},enableSnap:function(a,b,c,d){"undefined"==typeof c&&(c=!0),"undefined"==typeof d&&(d=!1),"undefined"==typeof snapOffsetX&&(snapOffsetX=0),"undefined"==typeof snapOffsetY&&(snapOffsetY=0),this.snapX=a,this.snapY=b,this.snapOffsetX=snapOffsetX,this.snapOffsetY=snapOffsetY,this.snapOnDrag=c,this.snapOnRelease=d},disableSnap:function(){this.snapOnDrag=!1,this.snapOnRelease=!1},checkBoundsRect:function(){this.sprite.fixedToCamera?(this.sprite.cameraOffset.xthis.boundsRect.right&&(this.sprite.cameraOffset.x=this.boundsRect.right-this.sprite.width),this.sprite.cameraOffset.ythis.boundsRect.bottom&&(this.sprite.cameraOffset.y=this.boundsRect.bottom-this.sprite.height)):(this.sprite.xthis.boundsRect.right&&(this.sprite.x=this.boundsRect.right-this.sprite.width),this.sprite.ythis.boundsRect.bottom&&(this.sprite.y=this.boundsRect.bottom-this.sprite.height))},checkBoundsSprite:function(){this.sprite.fixedToCamera&&this.boundsSprite.fixedToCamera?(this.sprite.cameraOffset.xthis.boundsSprite.camerOffset.x+this.boundsSprite.width&&(this.sprite.cameraOffset.x=this.boundsSprite.camerOffset.x+this.boundsSprite.width-this.sprite.width),this.sprite.cameraOffset.ythis.boundsSprite.camerOffset.y+this.boundsSprite.height&&(this.sprite.cameraOffset.y=this.boundsSprite.camerOffset.y+this.boundsSprite.height-this.sprite.height)):(this.sprite.xthis.boundsSprite.x+this.boundsSprite.width&&(this.sprite.x=this.boundsSprite.x+this.boundsSprite.width-this.sprite.width),this.sprite.ythis.boundsSprite.y+this.boundsSprite.height&&(this.sprite.y=this.boundsSprite.y+this.boundsSprite.height-this.sprite.height)) +}},b.InputHandler.prototype.constructor=b.InputHandler,b.Events=function(a){this.parent=a,this.onAddedToGroup=new b.Signal,this.onRemovedFromGroup=new b.Signal,this.onKilled=new b.Signal,this.onRevived=new b.Signal,this.onOutOfBounds=new b.Signal,this.onInputOver=null,this.onInputOut=null,this.onInputDown=null,this.onInputUp=null,this.onDragStart=null,this.onDragStop=null,this.onAnimationStart=null,this.onAnimationComplete=null,this.onAnimationLoop=null},b.Events.prototype={destroy:function(){this.parent=null,this.onAddedToGroup.dispose(),this.onRemovedFromGroup.dispose(),this.onKilled.dispose(),this.onRevived.dispose(),this.onOutOfBounds.dispose(),this.onInputOver&&(this.onInputOver.dispose(),this.onInputOut.dispose(),this.onInputDown.dispose(),this.onInputUp.dispose(),this.onDragStart.dispose(),this.onDragStop.dispose()),this.onAnimationStart&&(this.onAnimationStart.dispose(),this.onAnimationComplete.dispose(),this.onAnimationLoop.dispose())}},b.Events.prototype.constructor=b.Events,b.GameObjectFactory=function(a){this.game=a,this.world=this.game.world},b.GameObjectFactory.prototype={existing:function(a){return this.world.add(a)},image:function(a,c,d,e,f){return"undefined"==typeof f&&(f=this.world),f.add(new b.Image(this.game,a,c,d,e))},sprite:function(a,b,c,d,e){return"undefined"==typeof e&&(e=this.world),e.create(a,b,c,d)},tween:function(a){return this.game.tweens.create(a)},group:function(a,c,d){return"undefined"==typeof c&&(c="group"),"undefined"==typeof d&&(d=!1),new b.Group(this.game,a,c,d)},spriteBatch:function(a,c,d){return"undefined"==typeof c&&(c="group"),"undefined"==typeof d&&(d=!1),new b.SpriteBatch(this.game,a,c,d)},audio:function(a,b,c,d){return this.game.sound.add(a,b,c,d)},sound:function(a,b,c,d){return this.game.sound.add(a,b,c,d)},tileSprite:function(a,c,d,e,f,g,h){return"undefined"==typeof h&&(h=this.world),h.add(new b.TileSprite(this.game,a,c,d,e,f,g))},text:function(a,c,d,e,f){return"undefined"==typeof f&&(f=this.world),f.add(new b.Text(this.game,a,c,d,e))},button:function(a,c,d,e,f,g,h,i,j,k){return"undefined"==typeof k&&(k=this.world),k.add(new b.Button(this.game,a,c,d,e,f,g,h,i,j))},graphics:function(a,c,d){return"undefined"==typeof d&&(d=this.world),d.add(new b.Graphics(this.game,a,c))},emitter:function(a,c,d){return this.game.particles.add(new b.Particles.Arcade.Emitter(this.game,a,c,d))},bitmapFont:function(a,c,d,e,f,g,h,i,j){return new b.BitmapFont(this.game,a,c,d,e,f,g,h,i,j)},bitmapText:function(a,c,d,e,f,g){return"undefined"==typeof g&&(g=this.world),g.add(new b.BitmapText(this.game,a,c,d,e,f))},tilemap:function(a,c){return new b.Tilemap(this.game,a,c)},renderTexture:function(a,c,d,e){("undefined"==typeof d||""===d)&&(d=this.game.rnd.uuid()),"undefined"==typeof e&&(e=!1);var f=new b.RenderTexture(this.game,a,c,d);return e&&this.game.cache.addRenderTexture(d,f),f},bitmapData:function(a,c,d){"undefined"==typeof d&&(d=!1),("undefined"==typeof key||""===key)&&(key=this.game.rnd.uuid());var e=new b.BitmapData(this.game,key,a,c);return d&&this.game.cache.addBitmapData(key,e),e},filter:function(a){var c=Array.prototype.splice.call(arguments,1),a=new b.Filter[a](this.game);return a.init.apply(a,c),a}},b.GameObjectFactory.prototype.constructor=b.GameObjectFactory,b.BitmapData=function(c,d,e,f){"undefined"==typeof e&&(e=100),"undefined"==typeof f&&(f=100),this.game=c,this.key=d,this.width=e,this.height=f,this.canvas=b.Canvas.create(e,f),this.context=this.canvas.getContext("2d"),this.ctx=this.context,this.imageData=this.context.getImageData(0,0,e,f),this.pixels=this.imageData.data.buffer?this.imageData.data.buffer:this.imageData.data,this.baseTexture=new a.BaseTexture(this.canvas),this.texture=new a.Texture(this.baseTexture),this.textureFrame=new b.Frame(0,0,0,e,f,"bitmapData",c.rnd.uuid()),this.type=b.BITMAPDATA,this._dirty=!1},b.BitmapData.prototype={add:function(a){if(Array.isArray(a))for(var b=0;b=0&&a<=this.width&&b>=0&&b<=this.height&&(this.pixels[b*this.width+a]=f<<24|e<<16|d<<8|c,this.context.putImageData(this.imageData,0,0),this._dirty=!0)},setPixel:function(a,b,c,d,e){this.setPixel32(a,b,c,d,e,255)},getPixel:function(a,b){return a>=0&&a<=this.width&&b>=0&&b<=this.height?this.data32[b*this.width+a]:void 0},getPixel32:function(a,b){return a>=0&&a<=this.width&&b>=0&&b<=this.height?this.data32[b*this.width+a]:void 0},getPixels:function(a){return this.context.getImageData(a.x,a.y,a.width,a.height)},copyPixels:function(a,b,c,d){this.context.drawImage(a,b.x,b.y,b.width,b.height,c,d,b.width,b.height)},render:function(){this._dirty&&(this.game.renderType==b.WEBGL&&a.texturesToUpdate.push(this.baseTexture),this._dirty=!1)}},b.BitmapData.prototype.constructor=b.BitmapData,b.Sprite=function(c,d,e,f,g){d=d||0,e=e||0,f=f||null,g=g||null,this.game=c,this.name="",this.type=b.SPRITE,this.events=new b.Events(this),this.animations=new b.AnimationManager(this),this.key=f,this._frame=0,this._frameName="",a.Sprite.call(this,a.TextureCache.__default),this.loadTexture(f,g),this.position.set(d,e),this.world=new b.Point(d,e),this.autoCull=!1,this.input=null,this.body=null,this.health=1,this.lifespan=0,this.checkWorldBounds=!1,this.outOfBoundsKill=!1,this.debug=!1,this.cameraOffset=new b.Point,this._cache=new Int16Array([0,0,0,0,1,0,1,0]),this._bounds=new b.Rectangle},b.Sprite.prototype=Object.create(a.Sprite.prototype),b.Sprite.prototype.constructor=b.Sprite,b.Sprite.prototype.preUpdate=function(){if(1===this._cache[4])return this.world.setTo(this.parent.position.x+this.position.x,this.parent.position.y+this.position.y),this.worldTransform.tx=this.world.x,this.worldTransform.ty=this.world.y,this._cache[0]=this.world.x,this._cache[1]=this.world.y,this._cache[2]=this.rotation,this._cache[4]=0,!1;if(this._cache[0]=this.world.x,this._cache[1]=this.world.y,this._cache[2]=this.rotation,!this.exists||!this.parent.exists)return this._cache[3]=-1,!1;if(this.lifespan>0&&(this.lifespan-=this.game.time.elapsed,this.lifespan<=0))return this.kill(),!1;if((this.autoCull||this.checkWorldBounds)&&this._bounds.copyFrom(this.getBounds()),this.autoCull&&(this.renderable=this.game.world.camera.screenView.intersects(this._bounds)),this.checkWorldBounds)if(1===this._cache[5]&&this.game.world.bounds.intersects(this._bounds))this._cache[5]=0;else if(0===this._cache[5]&&!this.game.world.bounds.intersects(this._bounds)&&(this._cache[5]=1,this.events.onOutOfBounds.dispatch(this),this.outOfBoundsKill))return this.kill(),!1;return this.world.setTo(this.game.camera.x+this.worldTransform.tx,this.game.camera.y+this.worldTransform.ty),this.visible&&(this._cache[3]=this.game.world.currentRenderOrderID++),this.animations.update(),this.body,!0},b.Sprite.prototype.update=function(){},b.Sprite.prototype.postUpdate=function(){this.key instanceof b.BitmapData&&this.key._dirty&&this.key.render(),this.exists&&this.body&&this.body.postUpdate(),1===this._cache[7]&&(this.position.x=this.game.camera.view.x+this.cameraOffset.x,this.position.y=this.game.camera.view.y+this.cameraOffset.y)},b.Sprite.prototype.loadTexture=function(c,d){return d=d||0,c instanceof b.RenderTexture?(this.key=c.key,this.setTexture(c),void 0):c instanceof b.BitmapData?(this.key=c.key,this.setTexture(c.texture),void 0):c instanceof a.Texture?(this.key=c,this.setTexture(c),void 0):null===c||"undefined"==typeof c?(this.key="__default",this.setTexture(a.TextureCache[this.key]),void 0):"string"!=typeof c||this.game.cache.checkImageKey(c)?this.game.cache.isSpriteSheet(c)?(this.key=c,this.animations.loadFrameData(this.game.cache.getFrameData(c)),"string"==typeof d?this.frameName=d:this.frame=d,void 0):(this.key=c,this.setTexture(a.TextureCache[c]),void 0):(this.key="__missing",this.setTexture(a.TextureCache[this.key]),void 0)},b.Sprite.prototype.crop=function(c){if("undefined"==typeof c||null===c)this.texture.hasOwnProperty("sourceWidth")&&this.texture.setFrame(new b.Rectangle(0,0,this.texture.sourceWidth,this.texture.sourceHeight));else if(this.texture instanceof a.Texture){var d={};b.Utils.extend(!0,d,this.texture),d.sourceWidth=d.width,d.sourceHeight=d.height,d.frame=c,d.width=c.width,d.height=c.height,this.texture=d,this.texture.updateFrame=!0,a.Texture.frameUpdates.push(this.texture)}else this.texture.setFrame(c)},b.Sprite.prototype.revive=function(a){return"undefined"==typeof a&&(a=1),this.alive=!0,this.exists=!0,this.visible=!0,this.health=a,this.events&&this.events.onRevived.dispatch(this),this},b.Sprite.prototype.kill=function(){return this.alive=!1,this.exists=!1,this.visible=!1,this.events&&this.events.onKilled.dispatch(this),this},b.Sprite.prototype.destroy=function(){this.filters&&(this.filters=null),this.parent&&this.parent.remove(this),this.input&&this.input.destroy(),this.animations&&this.animations.destroy(),this.body&&this.body.destroy(),this.events&&this.events.destroy(),this.alive=!1,this.exists=!1,this.visible=!1,this.game=null},b.Sprite.prototype.damage=function(a){return this.alive&&(this.health-=a,this.health<0&&this.kill()),this},b.Sprite.prototype.reset=function(a,b,c){return"undefined"==typeof c&&(c=1),this.world.setTo(a,b),this.position.x=a,this.position.y=b,this.alive=!0,this.exists=!0,this.visible=!0,this.renderable=!0,this._outOfBoundsFired=!1,this.health=c,this.body&&this.body.reset(a,b,!1,!1),this},b.Sprite.prototype.bringToTop=function(a){return"undefined"==typeof a&&this.parent&&this.parent.bringToTop(this),this},b.Sprite.prototype.play=function(a,b,c,d){return this.animations?this.animations.play(a,b,c,d):void 0},Object.defineProperty(b.Sprite.prototype,"angle",{get:function(){return b.Math.wrapAngle(b.Math.radToDeg(this.rotation))},set:function(a){this.rotation=b.Math.degToRad(b.Math.wrapAngle(a))}}),Object.defineProperty(b.Sprite.prototype,"deltaX",{get:function(){return this.world.x-this._cache[0]}}),Object.defineProperty(b.Sprite.prototype,"deltaY",{get:function(){return this.world.y-this._cache[1]}}),Object.defineProperty(b.Sprite.prototype,"deltaZ",{get:function(){return this.rotation-this._cache[2]}}),Object.defineProperty(b.Sprite.prototype,"inWorld",{get:function(){return this.game.world.bounds.intersects(this.getBounds())}}),Object.defineProperty(b.Sprite.prototype,"inCamera",{get:function(){return this.game.world.camera.screenView.intersects(this.getBounds())}}),Object.defineProperty(b.Sprite.prototype,"frame",{get:function(){return this.animations.frame},set:function(a){this.animations.frame=a}}),Object.defineProperty(b.Sprite.prototype,"frameName",{get:function(){return this.animations.frameName},set:function(a){this.animations.frameName=a}}),Object.defineProperty(b.Sprite.prototype,"renderOrderID",{get:function(){return this._cache[3]}}),Object.defineProperty(b.Sprite.prototype,"inputEnabled",{get:function(){return this.input&&this.input.enabled},set:function(a){a?null===this.input&&(this.input=new b.InputHandler(this),this.input.start()):this.input&&this.input.enabled&&this.input.stop()}}),Object.defineProperty(b.Sprite.prototype,"physicsEnabled",{get:function(){return null!==this.body},set:function(a){a?null===this.body&&(this.body=new b.Physics.Body(this.game,this,this.x,this.y,1),this.anchor.set(.5)):this.body&&this.body.destroy()}}),Object.defineProperty(b.Sprite.prototype,"exists",{get:function(){return!!this._cache[6]},set:function(a){a?(this._cache[6]=1,this.body&&this.body.addToWorld(),this.visible=!0):(this._cache[6]=0,this.body&&this.body.removeFromWorld(),this.visible=!1)}}),Object.defineProperty(b.Sprite.prototype,"fixedToCamera",{get:function(){return!!this._cache[7]},set:function(a){a?(this._cache[7]=1,this.cameraOffset.set(this.x,this.y)):this._cache[7]=0}}),b.Image=function(c,d,e,f,g){d=d||0,e=e||0,f=f||null,g=g||null,this.game=c,this.exists=!0,this.name="",this.type=b.IMAGE,this.events=new b.Events(this),this.key=f,this._frame=0,this._frameName="",a.Sprite.call(this,a.TextureCache.__default),this.loadTexture(f,g),this.position.set(d,e),this.world=new b.Point(d,e),this.autoCull=!1,this.input=null,this.cameraOffset=new b.Point,this._cache=new Int16Array([0,0,0,0,1,0,1,0])},b.Image.prototype=Object.create(a.Sprite.prototype),b.Image.prototype.constructor=b.Image,b.Image.prototype.preUpdate=function(){return this._cache[0]=this.world.x,this._cache[1]=this.world.y,this._cache[2]=this.rotation,this.exists&&this.parent.exists?(this.autoCull&&(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]),this.visible&&(this._cache[3]=this.game.world.currentRenderOrderID++),!0):(this.renderOrderID=-1,!1)},b.Image.prototype.update=function(){},b.Image.prototype.postUpdate=function(){this.key instanceof b.BitmapData&&this.key._dirty&&this.key.render(),1===this._cache[7]&&(this.position.x=this.game.camera.view.x+this.cameraOffset.x,this.position.y=this.game.camera.view.y+this.cameraOffset.y)},b.Image.prototype.loadTexture=function(c,d){if(d=d||0,c instanceof b.RenderTexture)return this.key=c.key,this.setTexture(c),void 0;if(c instanceof b.BitmapData)return this.key=c.key,this.setTexture(c.texture),void 0;if(c instanceof a.Texture)return this.key=c,this.setTexture(c),void 0;if(null===c||"undefined"==typeof c)return this.key="__default",this.setTexture(a.TextureCache[this.key]),void 0;if("string"==typeof c&&!this.game.cache.checkImageKey(c))return this.key="__missing",this.setTexture(a.TextureCache[this.key]),void 0;if(this.game.cache.isSpriteSheet(c)){this.key=c;var e=this.game.cache.getFrameData(c);return"string"==typeof d?(this._frame=0,this._frameName=d,this.setTexture(a.TextureCache[e.getFrameByName(d).uuid]),void 0):(this._frame=d,this._frameName="",this.setTexture(a.TextureCache[e.getFrame(d).uuid]),void 0)}return this.key=c,this.setTexture(a.TextureCache[c]),void 0},b.Image.prototype.crop=function(c){if("undefined"==typeof c||null===c)this.texture.hasOwnProperty("sourceWidth")&&this.texture.setFrame(new b.Rectangle(0,0,this.texture.sourceWidth,this.texture.sourceHeight));else if(this.texture instanceof a.Texture){var d={};b.Utils.extend(!0,d,this.texture),d.sourceWidth=d.width,d.sourceHeight=d.height,d.frame=c,d.width=c.width,d.height=c.height,this.texture=d,this.texture.updateFrame=!0,a.Texture.frameUpdates.push(this.texture)}else this.texture.setFrame(c)},b.Image.prototype.revive=function(){return this.alive=!0,this.exists=!0,this.visible=!0,this.events&&this.events.onRevived.dispatch(this),this},b.Image.prototype.kill=function(){return this.alive=!1,this.exists=!1,this.visible=!1,this.events&&this.events.onKilled.dispatch(this),this},b.Image.prototype.destroy=function(){this.filters&&(this.filters=null),this.parent&&this.parent.remove(this),this.events&&this.events.destroy(),this.input&&this.input.destroy(),this.alive=!1,this.exists=!1,this.visible=!1,this.game=null},b.Image.prototype.reset=function(a,b){return this.world.setTo(a,b),this.position.x=a,this.position.y=b,this.alive=!0,this.exists=!0,this.visible=!0,this.renderable=!0,this},b.Image.prototype.bringToTop=function(a){return"undefined"==typeof a&&this.parent&&this.parent.bringToTop(this),this},Object.defineProperty(b.Image.prototype,"angle",{get:function(){return b.Math.wrapAngle(b.Math.radToDeg(this.rotation))},set:function(a){this.rotation=b.Math.degToRad(b.Math.wrapAngle(a))}}),Object.defineProperty(b.Image.prototype,"deltaX",{get:function(){return this.world.x-this._cache[0]}}),Object.defineProperty(b.Image.prototype,"deltaY",{get:function(){return this.world.y-this._cache[1]}}),Object.defineProperty(b.Image.prototype,"deltaZ",{get:function(){return this.rotation-this._cache[2]}}),Object.defineProperty(b.Image.prototype,"inWorld",{get:function(){return this.game.world.bounds.intersects(this.getBounds())}}),Object.defineProperty(b.Image.prototype,"inCamera",{get:function(){return this.game.world.camera.screenView.intersects(this.getBounds())}}),Object.defineProperty(b.Image.prototype,"frame",{get:function(){return this._frame},set:function(b){if(b!==this.frame&&this.game.cache.isSpriteSheet(this.key)){var c=this.game.cache.getFrameData(this.key);c&&be?(g>0&&(b+="\n"),b+=f[g]+" ",e=this.style.wordWrapWidth-h):(e-=i,b+=f[g]+" ")}d0)do this.removeChild(this.children[0]);while(this.children.length>0)},Object.defineProperty(b.BitmapText.prototype,"align",{get:function(){return this._align},set:function(a){a!==this._align&&(this._align=a,this.setStyle())}}),Object.defineProperty(b.BitmapText.prototype,"tint",{get:function(){return this._tint},set:function(a){a!==this._tint&&(this._tint=a,this.dirty=!0)}}),Object.defineProperty(b.BitmapText.prototype,"angle",{get:function(){return b.Math.radToDeg(this.rotation)},set:function(a){this.rotation=b.Math.degToRad(a)}}),Object.defineProperty(b.BitmapText.prototype,"font",{get:function(){return this._font},set:function(a){a!==this._font&&(this._font=a.trim(),this.style.font=this._fontSize+"px '"+this._font+"'",this.dirty=!0)}}),Object.defineProperty(b.BitmapText.prototype,"fontSize",{get:function(){return this._fontSize},set:function(a){a=parseInt(a),a!==this._fontSize&&(this._fontSize=a,this.style.font=this._fontSize+"px '"+this._font+"'",this.dirty=!0)}}),Object.defineProperty(b.BitmapText.prototype,"text",{get:function(){return this._text},set:function(a){a!==this._text&&(this._text=a.toString()||" ",this.dirty=!0)}}),Object.defineProperty(b.BitmapText.prototype,"inputEnabled",{get:function(){return this.input&&this.input.enabled},set:function(a){a?null===this.input&&(this.input=new b.InputHandler(this),this.input.start()):this.input&&this.input.enabled&&this.input.stop()}}),Object.defineProperty(b.BitmapText.prototype,"fixedToCamera",{get:function(){return!!this._cache[7]},set:function(a){a?(this._cache[7]=1,this.cameraOffset.set(this.x,this.y)):this._cache[7]=0}}),b.Button=function(a,c,d,e,f,g,h,i,j,k){c=c||0,d=d||0,e=e||null,f=f||null,g=g||this,b.Image.call(this,a,c,d,e,i),this.type=b.BUTTON,this._onOverFrameName=null,this._onOutFrameName=null,this._onDownFrameName=null,this._onUpFrameName=null,this._onOverFrameID=null,this._onOutFrameID=null,this._onDownFrameID=null,this._onUpFrameID=null,this.onOverSound=null,this.onOutSound=null,this.onDownSound=null,this.onUpSound=null,this.onOverSoundMarker="",this.onOutSoundMarker="",this.onDownSoundMarker="",this.onUpSoundMarker="",this.onInputOver=new b.Signal,this.onInputOut=new b.Signal,this.onInputDown=new b.Signal,this.onInputUp=new b.Signal,this.freezeFrames=!1,this.forceOut=!1,this.inputEnabled=!0,this.input.start(0,!0),this.setFrames(h,i,j,k),null!==f&&this.onInputUp.add(f,g),this.events.onInputOver.add(this.onInputOverHandler,this),this.events.onInputOut.add(this.onInputOutHandler,this),this.events.onInputDown.add(this.onInputDownHandler,this),this.events.onInputUp.add(this.onInputUpHandler,this) +},b.Button.prototype=Object.create(b.Image.prototype),b.Button.prototype.constructor=b.Button,b.Button.prototype.clearFrames=function(){this._onOverFrameName=null,this._onOverFrameID=null,this._onOutFrameName=null,this._onOutFrameID=null,this._onDownFrameName=null,this._onDownFrameID=null,this._onUpFrameName=null,this._onUpFrameID=null},b.Button.prototype.setFrames=function(a,b,c,d){this.clearFrames(),null!==a&&("string"==typeof a?(this._onOverFrameName=a,this.input.pointerOver()&&(this.frameName=a)):(this._onOverFrameID=a,this.input.pointerOver()&&(this.frame=a))),null!==b&&("string"==typeof b?(this._onOutFrameName=b,this.input.pointerOver()===!1&&(this.frameName=b)):(this._onOutFrameID=b,this.input.pointerOver()===!1&&(this.frame=b))),null!==c&&("string"==typeof c?(this._onDownFrameName=c,this.input.pointerDown()&&(this.frameName=c)):(this._onDownFrameID=c,this.input.pointerDown()&&(this.frame=c))),null!==d&&("string"==typeof d?(this._onUpFrameName=d,this.input.pointerUp()&&(this.frameName=d)):(this._onUpFrameID=d,this.input.pointerUp()&&(this.frame=d)))},b.Button.prototype.setSounds=function(a,b,c,d,e,f,g,h){this.setOverSound(a,b),this.setOutSound(e,f),this.setDownSound(c,d),this.setUpSound(g,h)},b.Button.prototype.setOverSound=function(a,c){this.onOverSound=null,this.onOverSoundMarker="",a instanceof b.Sound&&(this.onOverSound=a),"string"==typeof c&&(this.onOverSoundMarker=c)},b.Button.prototype.setOutSound=function(a,c){this.onOutSound=null,this.onOutSoundMarker="",a instanceof b.Sound&&(this.onOutSound=a),"string"==typeof c&&(this.onOutSoundMarker=c)},b.Button.prototype.setDownSound=function(a,c){this.onDownSound=null,this.onDownSoundMarker="",a instanceof b.Sound&&(this.onDownSound=a),"string"==typeof c&&(this.onDownSoundMarker=c)},b.Button.prototype.setUpSound=function(a,c){this.onUpSound=null,this.onUpSoundMarker="",a instanceof b.Sound&&(this.onUpSound=a),"string"==typeof c&&(this.onUpSoundMarker=c)},b.Button.prototype.onInputOverHandler=function(a,b){this.freezeFrames===!1&&this.setState(1),this.onOverSound&&this.onOverSound.play(this.onOverSoundMarker),this.onInputOver&&this.onInputOver.dispatch(this,b)},b.Button.prototype.onInputOutHandler=function(a,b){this.freezeFrames===!1&&this.setState(2),this.onOutSound&&this.onOutSound.play(this.onOutSoundMarker),this.onInputOut&&this.onInputOut.dispatch(this,b)},b.Button.prototype.onInputDownHandler=function(a,b){this.freezeFrames===!1&&this.setState(3),this.onDownSound&&this.onDownSound.play(this.onDownSoundMarker),this.onInputDown&&this.onInputDown.dispatch(this,b)},b.Button.prototype.onInputUpHandler=function(a,b,c){this.onUpSound&&this.onUpSound.play(this.onUpSoundMarker),this.onInputUp&&this.onInputUp.dispatch(this,b,c),this.freezeFrames||(this.forceOut?this.setState(2):this._onUpFrameName||this._onUpFrameID?this.setState(4):c?this.setState(1):this.setState(2))},b.Button.prototype.setState=function(a){1===a?null!=this._onOverFrameName?this.frameName=this._onOverFrameName:null!=this._onOverFrameID&&(this.frame=this._onOverFrameID):2===a?null!=this._onOutFrameName?this.frameName=this._onOutFrameName:null!=this._onOutFrameID&&(this.frame=this._onOutFrameID):3===a?null!=this._onDownFrameName?this.frameName=this._onDownFrameName:null!=this._onDownFrameID&&(this.frame=this._onDownFrameID):4===a&&(null!=this._onUpFrameName?this.frameName=this._onUpFrameName:null!=this._onUpFrameID&&(this.frame=this._onUpFrameID))},b.Graphics=function(c,d,e){d=d||0,e=e||0,this.game=c,this.exists=!0,this.name="",this.type=b.GRAPHICS,this.world=new b.Point(d,e),this.cameraOffset=new b.Point,a.Graphics.call(this),this.position.set(d,e),this._cache=new Int16Array([0,0,0,0,1,0,1,0])},b.Graphics.prototype=Object.create(a.Graphics.prototype),b.Graphics.prototype.constructor=b.Graphics,b.Graphics.prototype.preUpdate=function(){return this._cache[0]=this.world.x,this._cache[1]=this.world.y,this._cache[2]=this.rotation,this.exists&&this.parent.exists?(this.autoCull&&(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]),this.visible&&(this._cache[3]=this.game.world.currentRenderOrderID++),!0):(this.renderOrderID=-1,!1)},b.Graphics.prototype.update=function(){},b.Graphics.prototype.postUpdate=function(){1===this._cache[7]&&(this.position.x=this.game.camera.view.x+this.cameraOffset.x,this.position.y=this.game.camera.view.y+this.cameraOffset.y)},b.Graphics.prototype.destroy=function(){this.clear(),this.parent&&this.parent.remove(this),this.exists=!1,this.visible=!1,this.game=null},b.Graphics.prototype.drawPolygon=function(a){this.moveTo(a.points[0].x,a.points[0].y);for(var b=1;b?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",b.BitmapFont.TEXT_SET2=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",b.BitmapFont.TEXT_SET3="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",b.BitmapFont.TEXT_SET4="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",b.BitmapFont.TEXT_SET5="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",b.BitmapFont.TEXT_SET6="ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",b.BitmapFont.TEXT_SET7="AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",b.BitmapFont.TEXT_SET8="0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",b.BitmapFont.TEXT_SET9="ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",b.BitmapFont.TEXT_SET10="ABCDEFGHIJKLMNOPQRSTUVWXYZ",b.BitmapFont.TEXT_SET11="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789",b.BitmapFont.prototype.setFixedWidth=function(a,b){"undefined"==typeof b&&(b="left"),this.fixedWidth=a,this.align=b},b.BitmapFont.prototype.setText=function(a,b,c,d,e,f){this.multiLine=b||!1,this.customSpacingX=c||0,this.customSpacingY=d||0,this.align=e||"left",this.autoUpperCase=f?!1:!0,a.length>0&&(this.text=a)},b.BitmapFont.prototype.resize=function(b,c){if(this.width=b,this.height=c,this.frame.width=this.width,this.frame.height=this.height,this.baseTexture.width=this.width,this.baseTexture.height=this.height,this.renderer.type===a.WEBGL_RENDERER){this.projection.x=this.width/2,this.projection.y=-this.height/2;var d=this.renderer.gl;d.bindTexture(d.TEXTURE_2D,this.baseTexture._glTextures[d.id]),d.texImage2D(d.TEXTURE_2D,0,d.RGBA,this.width,this.height,0,d.RGBA,d.UNSIGNED_BYTE,null)}else this.textureBuffer.resize(this.width,this.height);a.Texture.frameUpdates.push(this)},b.BitmapFont.prototype.buildBitmapFontText=function(){var a=0,c=0;if(this.multiLine){var d=this._text.split("\n");this.fixedWidth>0?this.resize(fixedWidth,d.length*(this.characterHeight+this.customSpacingY)-this.customSpacingY):this.resize(this.getLongestLine()*(this.characterWidth+this.customSpacingX),d.length*(this.characterHeight+this.customSpacingY)-this.customSpacingY),this.textureBuffer.clear();for(var e=0;ea&&(a=0),this.pasteLine(d[e],a,c,this.customSpacingX),c+=this.characterHeight+this.customSpacingY}}else{switch(this.fixedWidth>0?this.resize(fixedWidth,this.characterHeight):this.resize(this._text.length*(this.characterWidth+this.customSpacingX),this.characterHeight),this.textureBuffer.clear(),this.align){case b.BitmapFont.ALIGN_LEFT:a=0;break;case b.BitmapFont.ALIGN_RIGHT:a=this.width-this._text.length*(this.characterWidth+this.customSpacingX);break;case b.BitmapFont.ALIGN_CENTER:a=this.width/2-this._text.length*(this.characterWidth+this.customSpacingX)/2,a+=this.customSpacingX/2}this.pasteLine(this._text,a,0,this.customSpacingX)}},b.BitmapFont.prototype.pasteLine=function(a,c,d){for(var e=new b.Point,f=0;f=0&&(this.stamp.frame=this.grabData[a.charCodeAt(f)],e.set(c,d),this.render(this.stamp,e,!1),c+=this.characterWidth+this.customSpacingX,c>this.width))break},b.BitmapFont.prototype.getLongestLine=function(){var a=0;if(this._text.length>0)for(var b=this._text.split("\n"),c=0;ca&&(a=b[c].length);return a},b.BitmapFont.prototype.removeUnsupportedCharacters=function(a){for(var b="",c=0;c=0||!a&&"\n"===d)&&(b=b.concat(d))}return b},Object.defineProperty(b.BitmapFont.prototype,"text",{get:function(){return this._text},set:function(a){var b;b=this.autoUpperCase?a.toUpperCase():a,b!==this._text&&(this._text=b,this.removeUnsupportedCharacters(this.multiLine),this.buildBitmapFontText())}}),b.Canvas={create:function(a,b,c){a=a||256,b=b||256;var d=document.createElement("canvas");return"string"==typeof c&&(d.id=c),d.width=a,d.height=b,d.style.display="block",d},getOffset:function(a,c){c=c||new b.Point;var d=a.getBoundingClientRect(),e=a.clientTop||document.body.clientTop||0,f=a.clientLeft||document.body.clientLeft||0,g=0,h=0;return"CSS1Compat"===document.compatMode?(g=window.pageYOffset||document.documentElement.scrollTop||a.scrollTop||0,h=window.pageXOffset||document.documentElement.scrollLeft||a.scrollLeft||0):(g=window.pageYOffset||document.body.scrollTop||a.scrollTop||0,h=window.pageXOffset||document.body.scrollLeft||a.scrollLeft||0),c.x=d.left+h-f,c.y=d.top+g-e,c},getAspectRatio:function(a){return a.width/a.height},setBackgroundColor:function(a,b){return b=b||"rgb(0,0,0)",a.style.backgroundColor=b,a},setTouchAction:function(a,b){return b=b||"none",a.style.msTouchAction=b,a.style["ms-touch-action"]=b,a.style["touch-action"]=b,a},setUserSelect:function(a,b){return b=b||"none",a.style["-webkit-touch-callout"]=b,a.style["-webkit-user-select"]=b,a.style["-khtml-user-select"]=b,a.style["-moz-user-select"]=b,a.style["-ms-user-select"]=b,a.style["user-select"]=b,a.style["-webkit-tap-highlight-color"]="rgba(0, 0, 0, 0)",a},addToDOM:function(a,b,c){var d;return"undefined"==typeof c&&(c=!0),b&&("string"==typeof b?d=document.getElementById(b):"object"==typeof b&&1===b.nodeType&&(d=b)),d||(d=document.body),c&&d.style&&(d.style.overflow="hidden"),d.appendChild(a),a},setTransform:function(a,b,c,d,e,f,g){return a.setTransform(d,f,g,e,b,c),a},setSmoothingEnabled:function(a,b){return a.imageSmoothingEnabled=b,a.mozImageSmoothingEnabled=b,a.oImageSmoothingEnabled=b,a.webkitImageSmoothingEnabled=b,a.msImageSmoothingEnabled=b,a},setImageRenderingCrisp:function(a){return a.style["image-rendering"]="optimizeSpeed",a.style["image-rendering"]="crisp-edges",a.style["image-rendering"]="-moz-crisp-edges",a.style["image-rendering"]="-webkit-optimize-contrast",a.style["image-rendering"]="optimize-contrast",a.style.msInterpolationMode="nearest-neighbor",a},setImageRenderingBicubic:function(a){return a.style["image-rendering"]="auto",a.style.msInterpolationMode="bicubic",a}},b.StageScaleMode=function(a,c,d){this.game=a,this.width=c,this.height=d,this.minWidth=null,this.maxWidth=null,this.minHeight=null,this.maxHeight=null,this.forceLandscape=!1,this.forcePortrait=!1,this.incorrectOrientation=!1,this.pageAlignHorizontally=!1,this.pageAlignVertically=!1,this.maxIterations=5,this.orientationSprite=null,this.enterLandscape=new b.Signal,this.enterPortrait=new b.Signal,this.enterIncorrectOrientation=new b.Signal,this.leaveIncorrectOrientation=new b.Signal,this.hasResized=new b.Signal,this.orientation=0,window.orientation?this.orientation=window.orientation:window.outerWidth>window.outerHeight&&(this.orientation=90),this.scaleFactor=new b.Point(1,1),this.scaleFactorInversed=new b.Point(1,1),this.margin=new b.Point(0,0),this.aspectRatio=0,this.sourceAspectRatio=c/d,this.event=null,this.scaleMode=b.StageScaleMode.NO_SCALE,this.fullScreenScaleMode=b.StageScaleMode.NO_SCALE,this._startHeight=0,this._width=0,this._height=0;var e=this;window.addEventListener("orientationchange",function(a){return e.checkOrientation(a)},!1),window.addEventListener("resize",function(a){return e.checkResize(a)},!1),document.addEventListener("webkitfullscreenchange",function(a){return e.fullScreenChange(a)},!1),document.addEventListener("mozfullscreenchange",function(a){return e.fullScreenChange(a)},!1),document.addEventListener("fullscreenchange",function(a){return e.fullScreenChange(a)},!1)},b.StageScaleMode.EXACT_FIT=0,b.StageScaleMode.NO_SCALE=1,b.StageScaleMode.SHOW_ALL=2,b.StageScaleMode.prototype={startFullScreen:function(a){if(!this.isFullScreen){"undefined"!=typeof a&&b.Canvas.setSmoothingEnabled(this.game.context,a);var c=this.game.canvas;this._width=this.width,this._height=this.height,c.requestFullScreen?c.requestFullScreen():c.mozRequestFullScreen?c.parentNode.mozRequestFullScreen():c.webkitRequestFullScreen&&c.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}},stopFullScreen:function(){document.cancelFullScreen?document.cancelFullScreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen()},fullScreenChange:function(a){this.event=a,this.isFullScreen?this.fullScreenScaleMode===b.StageScaleMode.EXACT_FIT?(this.game.canvas.style.width="100%",this.game.canvas.style.height="100%",this.setMaximum(),this.game.input.scale.setTo(this.game.width/this.width,this.game.height/this.height),this.aspectRatio=this.width/this.height,this.scaleFactor.x=this.game.width/this.width,this.scaleFactor.y=this.game.height/this.height):this.fullScreenScaleMode===b.StageScaleMode.SHOW_ALL&&(this.setShowAll(),this.refresh()):(this.game.canvas.style.width=this.game.width+"px",this.game.canvas.style.height=this.game.height+"px",this.width=this._width,this.height=this._height,this.game.input.scale.setTo(this.game.width/this.width,this.game.height/this.height),this.aspectRatio=this.width/this.height,this.scaleFactor.x=this.game.width/this.width,this.scaleFactor.y=this.game.height/this.height)},forceOrientation:function(b,c,d){"undefined"==typeof c&&(c=!1),this.forceLandscape=b,this.forcePortrait=c,"undefined"!=typeof d&&((null==d||this.game.cache.checkImageKey(d)===!1)&&(d="__default"),this.orientationSprite=new a.Sprite(a.TextureCache[d]),this.orientationSprite.anchor.x=.5,this.orientationSprite.anchor.y=.5,this.orientationSprite.position.x=this.game.width/2,this.orientationSprite.position.y=this.game.height/2,this.checkOrientationState(),this.incorrectOrientation?(this.orientationSprite.visible=!0,this.game.world.visible=!1):(this.orientationSprite.visible=!1,this.game.world.visible=!0),this.game.stage.addChild(this.orientationSprite))},checkOrientationState:function(){this.incorrectOrientation?(this.forceLandscape&&window.innerWidth>window.innerHeight||this.forcePortrait&&window.innerHeight>window.innerWidth)&&(this.game.paused=!1,this.incorrectOrientation=!1,this.leaveIncorrectOrientation.dispatch(),this.orientationSprite&&(this.orientationSprite.visible=!1,this.game.world.visible=!0),this.refresh()):(this.forceLandscape&&window.innerWidthwindow.outerHeight?90:0,this.isLandscape?this.enterLandscape.dispatch(this.orientation,!0,!1):this.enterPortrait.dispatch(this.orientation,!1,!0),this.scaleMode!==b.StageScaleMode.NO_SCALE&&this.refresh(),this.checkOrientationState()},refresh:function(){if(this.game.device.iPad===!1&&this.game.device.webApp===!1&&this.game.device.desktop===!1&&(this.game.device.android&&this.game.device.chrome===!1?window.scrollTo(0,1):window.scrollTo(0,0)),null==this._check&&this.maxIterations>0){this._iterations=this.maxIterations;var a=this;this._check=window.setInterval(function(){return a.setScreenSize()},10),this.setScreenSize()}},setScreenSize:function(a){"undefined"==typeof a&&(a=!1),this.game.device.iPad===!1&&this.game.device.webApp===!1&&this.game.device.desktop===!1&&(this.game.device.android&&this.game.device.chrome===!1?window.scrollTo(0,1):window.scrollTo(0,0)),this._iterations--,(a||window.innerHeight>this._startHeight||this._iterations<0)&&(document.documentElement.style.minHeight=window.innerHeight+"px",this.incorrectOrientation===!0?this.setMaximum():this.isFullScreen?this.fullScreenScaleMode==b.StageScaleMode.EXACT_FIT?this.setExactFit():this.fullScreenScaleMode==b.StageScaleMode.SHOW_ALL&&this.setShowAll():this.scaleMode==b.StageScaleMode.EXACT_FIT?this.setExactFit():this.scaleMode==b.StageScaleMode.SHOW_ALL&&this.setShowAll(),this.setSize(),clearInterval(this._check),this._check=null)},setSize:function(){this.incorrectOrientation===!1&&(this.maxWidth&&this.width>this.maxWidth&&(this.width=this.maxWidth),this.maxHeight&&this.height>this.maxHeight&&(this.height=this.maxHeight),this.minWidth&&this.widththis.maxWidth?this.maxWidth:a,this.height=this.maxHeight&&b>this.maxHeight?this.maxHeight:b}},b.StageScaleMode.prototype.constructor=b.StageScaleMode,Object.defineProperty(b.StageScaleMode.prototype,"isFullScreen",{get:function(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement}}),Object.defineProperty(b.StageScaleMode.prototype,"isPortrait",{get:function(){return 0===this.orientation||180==this.orientation}}),Object.defineProperty(b.StageScaleMode.prototype,"isLandscape",{get:function(){return 90===this.orientation||-90===this.orientation}}),b.Device=function(){this.patchAndroidClearRectBug=!1,this.desktop=!1,this.iOS=!1,this.cocoonJS=!1,this.ejecta=!1,this.android=!1,this.chromeOS=!1,this.linux=!1,this.macOS=!1,this.windows=!1,this.canvas=!1,this.file=!1,this.fileSystem=!1,this.localStorage=!1,this.webGL=!1,this.worker=!1,this.touch=!1,this.mspointer=!1,this.css3D=!1,this.pointerLock=!1,this.typedArray=!1,this.vibration=!1,this.quirksMode=!1,this.arora=!1,this.chrome=!1,this.epiphany=!1,this.firefox=!1,this.ie=!1,this.ieVersion=0,this.trident=!1,this.tridentVersion=0,this.mobileSafari=!1,this.midori=!1,this.opera=!1,this.safari=!1,this.webApp=!1,this.silk=!1,this.audioData=!1,this.webAudio=!1,this.ogg=!1,this.opus=!1,this.mp3=!1,this.wav=!1,this.m4a=!1,this.webm=!1,this.iPhone=!1,this.iPhone4=!1,this.iPad=!1,this.pixelRatio=0,this.littleEndian=!1,this._checkAudio(),this._checkBrowser(),this._checkCSS3D(),this._checkDevice(),this._checkFeatures(),this._checkOS()},b.Device.prototype={_checkOS:function(){var a=navigator.userAgent;/Android/.test(a)?this.android=!0:/CrOS/.test(a)?this.chromeOS=!0:/iP[ao]d|iPhone/i.test(a)?this.iOS=!0:/Linux/.test(a)?this.linux=!0:/Mac OS/.test(a)?this.macOS=!0:/Windows/.test(a)&&(this.windows=!0),(this.windows||this.macOS||this.linux&&this.silk===!1)&&(this.desktop=!0)},_checkFeatures:function(){this.canvas=!!window.CanvasRenderingContext2D;try{this.localStorage=!!localStorage.getItem}catch(a){this.localStorage=!1}this.file=!!(window.File&&window.FileReader&&window.FileList&&window.Blob),this.fileSystem=!!window.requestFileSystem,this.webGL=function(){try{var a=document.createElement("canvas");return!!window.WebGLRenderingContext&&(a.getContext("webgl")||a.getContext("experimental-webgl"))}catch(b){return!1}}(),this.webGL=null===this.webGL||this.webGL===!1?!1:!0,this.worker=!!window.Worker,("ontouchstart"in document.documentElement||window.navigator.maxTouchPoints&&window.navigator.maxTouchPoints>1)&&(this.touch=!0),(window.navigator.msPointerEnabled||window.navigator.pointerEnabled)&&(this.mspointer=!0),this.pointerLock="pointerLockElement"in document||"mozPointerLockElement"in document||"webkitPointerLockElement"in document,this.quirksMode="CSS1Compat"===document.compatMode?!1:!0},_checkBrowser:function(){var a=navigator.userAgent;/Arora/.test(a)?this.arora=!0:/Chrome/.test(a)?this.chrome=!0:/Epiphany/.test(a)?this.epiphany=!0:/Firefox/.test(a)?this.firefox=!0:/Mobile Safari/.test(a)?this.mobileSafari=!0:/MSIE (\d+\.\d+);/.test(a)?(this.ie=!0,this.ieVersion=parseInt(RegExp.$1,10)):/Midori/.test(a)?this.midori=!0:/Opera/.test(a)?this.opera=!0:/Safari/.test(a)?this.safari=!0:/Silk/.test(a)?this.silk=!0:/Trident\/(\d+\.\d+); rv:(\d+\.\d+)/.test(a)&&(this.ie=!0,this.trident=!0,this.tridentVersion=parseInt(RegExp.$1,10),this.ieVersion=parseInt(RegExp.$2,10)),navigator.standalone&&(this.webApp=!0),navigator.isCocoonJS&&(this.cocoonJS=!0),"undefined"!=typeof window.ejecta&&(this.ejecta=!0)},_checkAudio:function(){this.audioData=!!window.Audio,this.webAudio=!(!window.webkitAudioContext&&!window.AudioContext);var a=document.createElement("audio"),b=!1;try{(b=!!a.canPlayType)&&(a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")&&(this.ogg=!0),a.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,"")&&(this.opus=!0),a.canPlayType("audio/mpeg;").replace(/^no$/,"")&&(this.mp3=!0),a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,"")&&(this.wav=!0),(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;").replace(/^no$/,""))&&(this.m4a=!0),a.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")&&(this.webm=!0))}catch(c){}},_checkDevice:function(){this.pixelRatio=window.devicePixelRatio||1,this.iPhone=-1!=navigator.userAgent.toLowerCase().indexOf("iphone"),this.iPhone4=2==this.pixelRatio&&this.iPhone,this.iPad=-1!=navigator.userAgent.toLowerCase().indexOf("ipad"),"undefined"!=typeof Int8Array?(this.littleEndian=new Int8Array(new Int16Array([1]).buffer)[0]>0,this.typedArray=!0):(this.littleEndian=!1,this.typedArray=!1),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate,navigator.vibrate&&(this.vibration=!0)},_checkCSS3D:function(){var a,b=document.createElement("p"),c={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.insertBefore(b,null);for(var d in c)void 0!==b.style[d]&&(b.style[d]="translate3d(1px,1px,1px)",a=window.getComputedStyle(b).getPropertyValue(c[d]));document.body.removeChild(b),this.css3D=void 0!==a&&a.length>0&&"none"!==a},canPlayAudio:function(a){return"mp3"==a&&this.mp3?!0:"ogg"==a&&(this.ogg||this.opus)?!0:"m4a"==a&&this.m4a?!0:"wav"==a&&this.wav?!0:"webm"==a&&this.webm?!0:!1},isConsoleOpen:function(){return window.console&&window.console.firebug?!0:window.console?(console.profile(),console.profileEnd(),console.clear&&console.clear(),console.profiles.length>0):!1}},b.Device.prototype.constructor=b.Device,b.RequestAnimationFrame=function(a){this.game=a,this.isRunning=!1;for(var b=["ms","moz","webkit","o"],c=0;ca},fuzzyGreaterThan:function(a,b,c){return"undefined"==typeof c&&(c=1e-4),a>b-c},fuzzyCeil:function(a,b){return"undefined"==typeof b&&(b=1e-4),Math.ceil(a-b)},fuzzyFloor:function(a,b){return"undefined"==typeof b&&(b=1e-4),Math.floor(a+b)},average:function(){for(var a=[],b=0;b0?Math.floor(a):Math.ceil(a)},shear:function(a){return a%1},snapTo:function(a,b,c){return"undefined"==typeof c&&(c=0),0===b?a:(a-=c,a=b*Math.round(a/b),c+a)},snapToFloor:function(a,b,c){return"undefined"==typeof c&&(c=0),0===b?a:(a-=c,a=b*Math.floor(a/b),c+a)},snapToCeil:function(a,b,c){return"undefined"==typeof c&&(c=0),0===b?a:(a-=c,a=b*Math.ceil(a/b),c+a)},snapToInArray:function(a,b,c){if("undefined"==typeof c&&(c=!0),c&&b.sort(),a=f-a?f:e},roundTo:function(a,b,c){"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=10);var d=Math.pow(c,-b);return Math.round(a*d)/d},floorTo:function(a,b,c){"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=10);var d=Math.pow(c,-b);return Math.floor(a*d)/d},ceilTo:function(a,b,c){"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=10);var d=Math.pow(c,-b);return Math.ceil(a*d)/d},interpolateFloat:function(a,b,c){return(b-a)*c+a},angleBetween:function(a,b,c,d){return Math.atan2(c-a,d-b)},angleBetweenPoints:function(a,b){return Math.atan2(b.x-a.x,b.y-a.y)},reverseAngle:function(a){return this.normalizeAngle(a+Math.PI,!0)},normalizeAngle:function(a){return a%=2*Math.PI,a>=0?a:a+2*Math.PI},normalizeLatitude:function(a){return Math.max(-90,Math.min(90,a))},normalizeLongitude:function(a){return 180==a%360?180:(a%=360,-180>a?a+360:a>180?a-360:a)},nearestAngleBetween:function(a,b,c){"undefined"==typeof c&&(c=!0);var d=c?Math.PI:180;return a=this.normalizeAngle(a,c),b=this.normalizeAngle(b,c),-d/2>a&&b>d/2&&(a+=2*d),-d/2>b&&a>d/2&&(b+=2*d),b-a},interpolateAngles:function(a,b,c,d,e){return"undefined"==typeof d&&(d=!0),"undefined"==typeof e&&(e=null),a=this.normalizeAngle(a,d),b=this.normalizeAngleToAnother(b,a,d),"function"==typeof e?e(c,a,b-a,1):this.interpolateFloat(a,b,c)},chanceRoll:function(a){return"undefined"==typeof a&&(a=50),0>=a?!1:a>=100?!0:100*Math.random()>=a?!1:!0},numberArray:function(a,b){for(var c=[],d=a;b>=d;d++)c.push(d);return c},maxAdd:function(a,b,c){return a+=b,a>c&&(a=c),a},minSub:function(a,b,c){return a-=b,c>a&&(a=c),a},wrap:function(a,b,c){var d=c-b;if(0>=d)return 0;var e=(a-b)%d;return 0>e&&(e+=d),e+b},wrapValue:function(a,b,c){var d;return a=Math.abs(a),b=Math.abs(b),c=Math.abs(c),d=(a+b)%c},randomSign:function(){return Math.random()>.5?1:-1},isOdd:function(a){return 1&a},isEven:function(a){return 1&a?!1:!0},max:function(){for(var a=1,b=0,c=arguments.length;c>a;a++)arguments[b]b;b++)a[b]b;b++)a[b]>a[c]&&(c=b);return a[c]},minProperty:function(a){if(2===arguments.length&&"object"==typeof arguments[1])var b=arguments[1];else var b=arguments.slice(1);for(var c=1,d=0,e=b.length;e>c;c++)b[c][a]c;c++)b[c][a]>b[d][a]&&(d=c);return b[d][a]},wrapAngle:function(a){return this.wrap(a,-180,180)},angleLimit:function(a,b,c){var d=a;return a>c?d=c:b>a&&(d=b),d},linearInterpolation:function(a,b){var c=a.length-1,d=c*b,e=Math.floor(d);return 0>b?this.linear(a[0],a[1],d):b>1?this.linear(a[c],a[c-1],c-d):this.linear(a[e],a[e+1>c?c:e+1],d-e) +},bezierInterpolation:function(a,b){for(var c=0,d=a.length-1,e=0;d>=e;e++)c+=Math.pow(1-b,d-e)*Math.pow(b,e)*a[e]*this.bernstein(d,e);return c},catmullRomInterpolation:function(a,b){var c=a.length-1,d=c*b,e=Math.floor(d);return a[0]===a[c]?(0>b&&(e=Math.floor(d=c*(1+b))),this.catmullRom(a[(e-1+c)%c],a[e],a[(e+1)%c],a[(e+2)%c],d-e)):0>b?a[0]-(this.catmullRom(a[0],a[0],a[1],a[1],-d)-a[0]):b>1?a[c]-(this.catmullRom(a[c],a[c],a[c-1],a[c-1],d-c)-a[c]):this.catmullRom(a[e?e-1:0],a[e],a[e+1>c?c:e+1],a[e+2>c?c:e+2],d-e)},linear:function(a,b,c){return(b-a)*c+a},bernstein:function(a,b){return this.factorial(a)/this.factorial(b)/this.factorial(a-b)},catmullRom:function(a,b,c,d,e){var f=.5*(c-a),g=.5*(d-b),h=e*e,i=e*h;return(2*b-2*c+f+g)*i+(-3*b+3*c-2*f-g)*h+f*e+b},difference:function(a,b){return Math.abs(a-b)},getRandom:function(a,b,c){if("undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=0),null!=a){var d=c;if((0===d||d>a.length-b)&&(d=a.length-b),d>0)return a[b+Math.floor(Math.random()*d)]}return null},floor:function(a){var b=0|a;return a>0?b:b!=a?b-1:b},ceil:function(a){var b=0|a;return a>0?b!=a?b+1:b:b},sinCosGenerator:function(a,b,c,d){"undefined"==typeof b&&(b=1),"undefined"==typeof c&&(c=1),"undefined"==typeof d&&(d=1);for(var e=b,f=c,g=d*Math.PI/a,h=[],i=[],j=0;a>j;j++)f-=e*g,e+=f*g,h[j]=f,i[j]=e;return{sin:i,cos:h,length:a}},shift:function(a){var b=a.shift();return a.push(b),b},shuffleArray:function(a){for(var b=a.length-1;b>0;b--){var c=Math.floor(Math.random()*(b+1)),d=a[b];a[b]=a[c],a[c]=d}return a},distance:function(a,b,c,d){var e=a-c,f=b-d;return Math.sqrt(e*e+f*f)},distancePow:function(a,b,c,d,e){return"undefined"==typeof e&&(e=2),Math.sqrt(Math.pow(c-a,e)+Math.pow(d-b,e))},distanceRounded:function(a,c,d,e){return Math.round(b.Math.distance(a,c,d,e))},clamp:function(a,b,c){return b>a?b:a>c?c:a},clampBottom:function(a,b){return b>a?b:a},within:function(a,b,c){return Math.abs(a-b)<=c},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a,b,c){return b>=a?0:a>=c?1:(a=(a-b)/(c-b),a*a*(3-2*a))},smootherstep:function(a,b,c){return b>=a?0:a>=c?1:(a=(a-b)/(c-b),a*a*a*(a*(6*a-15)+10))},sign:function(a){return 0>a?-1:a>0?1:0},p2px:function(a){return a*=-20},px2p:function(a){return a*-.05},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}()},b.RandomDataGenerator=function(a){"undefined"==typeof a&&(a=[]),this.c=1,this.s0=0,this.s1=0,this.s2=0,this.sow(a)},b.RandomDataGenerator.prototype={rnd:function(){var a=2091639*this.s0+2.3283064365386963e-10*this.c;return this.c=0|a,this.s0=this.s1,this.s1=this.s2,this.s2=a-this.c,this.s2},sow:function(a){"undefined"==typeof a&&(a=[]),this.s0=this.hash(" "),this.s1=this.hash(this.s0),this.s2=this.hash(this.s1),this.c=1;for(var b,c=0;b=a[c++];)this.s0-=this.hash(b),this.s0+=~~(this.s0<0),this.s1-=this.hash(b),this.s1+=~~(this.s1<0),this.s2-=this.hash(b),this.s2+=~~(this.s2<0)},hash:function(a){var b,c,d;for(d=4022871197,a=a.toString(),c=0;c>>0,b-=d,b*=d,d=b>>>0,b-=d,d+=4294967296*b;return 2.3283064365386963e-10*(d>>>0)},integer:function(){return 4294967296*this.rnd.apply(this)},frac:function(){return this.rnd.apply(this)+1.1102230246251565e-16*(0|2097152*this.rnd.apply(this))},real:function(){return this.integer()+this.frac()},integerInRange:function(a,b){return Math.floor(this.realInRange(a,b))},realInRange:function(a,b){return this.frac()*(b-a)+a},normal:function(){return 1-2*this.frac()},uuid:function(){var a="",b="";for(b=a="";a++<36;b+=~a%5|4&3*a?(15^a?8^this.frac()*(20^a?16:4):4).toString(16):"-");return b},pick:function(a){return a[this.integerInRange(0,a.length)]},weightedPick:function(a){return a[~~(Math.pow(this.frac(),2)*a.length)]},timestamp:function(a,b){return this.realInRange(a||9466848e5,b||1577862e6)},angle:function(){return this.integerInRange(-180,180)}},b.RandomDataGenerator.prototype.constructor=b.RandomDataGenerator,b.QuadTree=function(a,b,c,d,e,f,g){this.maxObjects=e||10,this.maxLevels=f||4,this.level=g||0,this.bounds={x:Math.round(a),y:Math.round(b),width:c,height:d,subWidth:Math.floor(c/2),subHeight:Math.floor(d/2),right:Math.round(a)+Math.floor(c/2),bottom:Math.round(b)+Math.floor(d/2)},this.objects=[],this.nodes=[]},b.QuadTree.prototype={populate:function(a){a.forEach(this.populateHandler,this,!0)},populateHandler:function(a){a.body&&a.body.checkCollision.none===!1&&a.alive&&this.insert(a.body)},split:function(){this.level++,this.nodes[0]=new b.QuadTree(this.bounds.right,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level),this.nodes[1]=new b.QuadTree(this.bounds.x,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level),this.nodes[2]=new b.QuadTree(this.bounds.x,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level),this.nodes[3]=new b.QuadTree(this.bounds.right,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level)},insert:function(a){var b,c=0;if(null!=this.nodes[0]&&(b=this.getIndex(a),-1!==b))return this.nodes[b].insert(a),void 0;if(this.objects.push(a),this.objects.length>this.maxObjects&&this.levelthis.bounds.bottom&&(b=2):a.x>this.bounds.right&&(a.ythis.bounds.bottom&&(b=3)),b},retrieve:function(a){var b=this.objects;return a.body.quadTreeIndex=this.getIndex(a.body),this.nodes[0]&&(-1!==a.body.quadTreeIndex?b=b.concat(this.nodes[a.body.quadTreeIndex].retrieve(a)):(b=b.concat(this.nodes[0].retrieve(a)),b=b.concat(this.nodes[1].retrieve(a)),b=b.concat(this.nodes[2].retrieve(a)),b=b.concat(this.nodes[3].retrieve(a)))),b},clear:function(){this.objects=[];for(var a=0,b=this.nodes.length;b>a;a++)this.nodes[a]&&(this.nodes[a].clear(),delete this.nodes[a])}},b.QuadTree.prototype.constructor=b.QuadTree,b.Net=function(a){this.game=a},b.Net.prototype={getHostName:function(){return window.location&&window.location.hostname?window.location.hostname:null},checkDomainName:function(a){return-1!==window.location.hostname.indexOf(a)},updateQueryString:function(a,b,c,d){"undefined"==typeof c&&(c=!1),("undefined"==typeof d||""===d)&&(d=window.location.href);var e="",f=new RegExp("([?|&])"+a+"=.*?(&|#|$)(.*)","gi");if(f.test(d))e="undefined"!=typeof b&&null!==b?d.replace(f,"$1"+a+"="+b+"$2$3"):d.replace(f,"$1$3").replace(/(&|\?)$/,"");else if("undefined"!=typeof b&&null!==b){var g=-1!==d.indexOf("?")?"&":"?",h=d.split("#");d=h[0]+g+a+"="+b,h[1]&&(d+="#"+h[1]),e=d}else e=d;return c?(window.location.href=e,void 0):e},getQueryString:function(a){"undefined"==typeof a&&(a="");var b={},c=location.search.substring(1).split("&");for(var d in c){var e=c[d].split("=");if(e.length>1){if(a&&a==this.decodeURI(e[0]))return this.decodeURI(e[1]);b[this.decodeURI(e[0])]=this.decodeURI(e[1])}}return b},decodeURI:function(a){return decodeURIComponent(a.replace(/\+/g," "))}},b.Net.prototype.constructor=b.Net,b.TweenManager=function(a){this.game=a,this._tweens=[],this._add=[],this.game.onPause.add(this.pauseAll,this),this.game.onResume.add(this.resumeAll,this)},b.TweenManager.prototype={getAll:function(){return this._tweens},removeAll:function(){for(var a=0;aa;)this._tweens[a].update(this.game.time.now)?a++:(this._tweens.splice(a,1),b--);return this._add.length>0&&(this._tweens=this._tweens.concat(this._add),this._add.length=0),!0},isTweening:function(a){return this._tweens.some(function(b){return b._object===a})},pauseAll:function(){for(var a=this._tweens.length-1;a>=0;a--)this._tweens[a].pause()},resumeAll:function(){for(var a=this._tweens.length-1;a>=0;a--)this._tweens[a].resume()}},b.TweenManager.prototype.constructor=b.TweenManager,b.Tween=function(a,c){this._object=a,this.game=c,this._manager=this.game.tweens,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._repeat=0,this._yoyo=!1,this._reversed=!1,this._delayTime=0,this._startTime=null,this._easingFunction=b.Easing.Linear.None,this._interpolationFunction=b.Math.linearInterpolation,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onUpdateCallbackContext=null,this._pausedTime=0,this.pendingDelete=!1;for(var d in a)this._valuesStart[d]=parseFloat(a[d],10);this.onStart=new b.Signal,this.onLoop=new b.Signal,this.onComplete=new b.Signal,this.isRunning=!1},b.Tween.prototype={to:function(a,b,c,d,e,f,g){b=b||1e3,c=c||null,d=d||!1,e=e||0,f=f||0,g=g||!1;var h;return this._parent?(h=this._manager.create(this._object),this._lastChild.chain(h),this._lastChild=h):(h=this,this._parent=this,this._lastChild=this),h._repeat=f,h._duration=b,h._valuesEnd=a,null!==c&&(h._easingFunction=c),e>0&&(h._delayTime=e),h._yoyo=g,d?this.start():this},start:function(){if(null!==this.game&&null!==this._object){this._manager.add(this),this.isRunning=!0,this._onStartCallbackFired=!1,this._startTime=this.game.time.now+this._delayTime;for(var a in this._valuesEnd){if(this._valuesEnd[a]instanceof Array){if(0===this._valuesEnd[a].length)continue;this._valuesEnd[a]=[this._object[a]].concat(this._valuesEnd[a])}this._valuesStart[a]=this._object[a],this._valuesStart[a]instanceof Array==!1&&(this._valuesStart[a]*=1),this._valuesStartRepeat[a]=this._valuesStart[a]||0}return this}},stop:function(){return this.isRunning=!1,this._onUpdateCallback=null,this._manager.remove(this),this},delay:function(a){return this._delayTime=a,this},repeat:function(a){return this._repeat=a,this},yoyo:function(a){return this._yoyo=a,this},easing:function(a){return this._easingFunction=a,this},interpolation:function(a){return this._interpolationFunction=a,this},chain:function(){return this._chainedTweens=arguments,this},loop:function(){return this._lastChild.chain(this),this},onUpdateCallback:function(a,b){return this._onUpdateCallback=a,this._onUpdateCallbackContext=b,this},pause:function(){this._paused=!0,this._pausedTime=this.game.time.now},resume:function(){this._paused=!1,this._startTime+=this.game.time.now-this._pausedTime},update:function(a){if(this.pendingDelete)return!1;if(this._paused||a1?1:c;var d=this._easingFunction(c);for(b in this._valuesEnd){var e=this._valuesStart[b]||0,f=this._valuesEnd[b];f instanceof Array?this._object[b]=this._interpolationFunction(f,d):("string"==typeof f&&(f=e+parseFloat(f,10)),"number"==typeof f&&(this._object[b]=e+(f-e)*d))}if(null!==this._onUpdateCallback&&this._onUpdateCallback.call(this._onUpdateCallbackContext,this,d),1==c){if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(b in this._valuesStartRepeat){if("string"==typeof this._valuesEnd[b]&&(this._valuesStartRepeat[b]=this._valuesStartRepeat[b]+parseFloat(this._valuesEnd[b],10)),this._yoyo){var g=this._valuesStartRepeat[b];this._valuesStartRepeat[b]=this._valuesEnd[b],this._valuesEnd[b]=g,this._reversed=!this._reversed}this._valuesStart[b]=this._valuesStartRepeat[b]}return this._startTime=a+this._delayTime,this.onLoop.dispatch(this._object),!0}this.isRunning=!1,this.onComplete.dispatch(this._object);for(var h=0,i=this._chainedTweens.length;i>h;h++)this._chainedTweens[h].start(a);return!1}return!0}},b.Tween.prototype.constructor=b.Tween,b.Easing={Linear:{None:function(a){return a}},Quadratic:{In:function(a){return a*a},Out:function(a){return a*(2-a)},InOut:function(a){return(a*=2)<1?.5*a*a:-.5*(--a*(a-2)-1)}},Cubic:{In:function(a){return a*a*a},Out:function(a){return--a*a*a+1},InOut:function(a){return(a*=2)<1?.5*a*a*a:.5*((a-=2)*a*a+2)}},Quartic:{In:function(a){return a*a*a*a},Out:function(a){return 1- --a*a*a*a},InOut:function(a){return(a*=2)<1?.5*a*a*a*a:-.5*((a-=2)*a*a*a-2)}},Quintic:{In:function(a){return a*a*a*a*a},Out:function(a){return--a*a*a*a*a+1},InOut:function(a){return(a*=2)<1?.5*a*a*a*a*a:.5*((a-=2)*a*a*a*a+2)}},Sinusoidal:{In:function(a){return 1-Math.cos(a*Math.PI/2)},Out:function(a){return Math.sin(a*Math.PI/2)},InOut:function(a){return.5*(1-Math.cos(Math.PI*a))}},Exponential:{In:function(a){return 0===a?0:Math.pow(1024,a-1)},Out:function(a){return 1===a?1:1-Math.pow(2,-10*a)},InOut:function(a){return 0===a?0:1===a?1:(a*=2)<1?.5*Math.pow(1024,a-1):.5*(-Math.pow(2,-10*(a-1))+2)}},Circular:{In:function(a){return 1-Math.sqrt(1-a*a)},Out:function(a){return Math.sqrt(1- --a*a)},InOut:function(a){return(a*=2)<1?-.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)}},Elastic:{In:function(a){var b,c=.1,d=.4;return 0===a?0:1===a?1:(!c||1>c?(c=1,b=d/4):b=d*Math.asin(1/c)/(2*Math.PI),-(c*Math.pow(2,10*(a-=1))*Math.sin((a-b)*2*Math.PI/d)))},Out:function(a){var b,c=.1,d=.4;return 0===a?0:1===a?1:(!c||1>c?(c=1,b=d/4):b=d*Math.asin(1/c)/(2*Math.PI),c*Math.pow(2,-10*a)*Math.sin((a-b)*2*Math.PI/d)+1)},InOut:function(a){var b,c=.1,d=.4;return 0===a?0:1===a?1:(!c||1>c?(c=1,b=d/4):b=d*Math.asin(1/c)/(2*Math.PI),(a*=2)<1?-.5*c*Math.pow(2,10*(a-=1))*Math.sin((a-b)*2*Math.PI/d):.5*c*Math.pow(2,-10*(a-=1))*Math.sin((a-b)*2*Math.PI/d)+1)}},Back:{In:function(a){var b=1.70158;return a*a*((b+1)*a-b)},Out:function(a){var b=1.70158;return--a*a*((b+1)*a+b)+1},InOut:function(a){var b=2.5949095;return(a*=2)<1?.5*a*a*((b+1)*a-b):.5*((a-=2)*a*((b+1)*a+b)+2)}},Bounce:{In:function(a){return 1-b.Easing.Bounce.Out(1-a)},Out:function(a){return 1/2.75>a?7.5625*a*a:2/2.75>a?7.5625*(a-=1.5/2.75)*a+.75:2.5/2.75>a?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},InOut:function(a){return.5>a?.5*b.Easing.Bounce.In(2*a):.5*b.Easing.Bounce.Out(2*a-1)+.5}}},b.Time=function(a){this.game=a,this.time=0,this.now=0,this.elapsed=0,this.pausedTime=0,this.fps=0,this.fpsMin=1e3,this.fpsMax=0,this.msMin=1e3,this.msMax=0,this.physicsElapsed=0,this.frames=0,this.pauseDuration=0,this.timeToCall=0,this.lastTime=0,this.events=new b.Timer(this.game,!1),this._started=0,this._timeLastSecond=0,this._pauseStarted=0,this._justResumed=!1,this._timers=[],this._len=0,this._i=0,this.game.onPause.add(this.gamePaused,this),this.game.onResume.add(this.gameResumed,this)},b.Time.prototype={boot:function(){this.events.start()},create:function(a){"undefined"==typeof a&&(a=!0);var c=new b.Timer(this.game,a);return this._timers.push(c),c},removeAll:function(){for(var a=0;athis._timeLastSecond+1e3&&(this.fps=Math.round(1e3*this.frames/(this.now-this._timeLastSecond)),this.fpsMin=this.game.math.min(this.fpsMin,this.fps),this.fpsMax=this.game.math.max(this.fpsMax,this.fps),this._timeLastSecond=this.now,this.frames=0),this.time=this.now,this.lastTime=a+this.timeToCall,this.physicsElapsed=1*(this.elapsed/1e3),this.physicsElapsed>.05&&(this.physicsElapsed=.05),this.game.paused)this.pausedTime=this.now-this._pauseStarted;else for(this.events.update(this.now),this._i=0,this._len=this._timers.length;this._i0&&(this.events.sort(this.sortHandler),this.nextTick=this.events[0].tick)},sortHandler:function(a,b){return a.tickb.tick?1:0},update:function(a){if(this.paused)return!0;for(this._now=a-this._started,this._len=this.events.length,this._i=0;this._i=this.nextTick&&this._len>0){for(this._i=0;this._i=this.events[this._i].tick;)this.events[this._i].loop===!0?(this.events[this._i].tick+=this.events[this._i].delay-(this._now-this.events[this._i].tick),this.events[this._i].callback.apply(this.events[this._i].callbackContext,this.events[this._i].args)):this.events[this._i].repeatCount>0?(this.events[this._i].repeatCount--,this.events[this._i].tick+=this.events[this._i].delay-(this._now-this.events[this._i].tick),this.events[this._i].callback.apply(this.events[this._i].callbackContext,this.events[this._i].args)):(this.events[this._i].callback.apply(this.events[this._i].callbackContext,this.events[this._i].args),this.events.splice(this._i,1),this._len--),this._i++;this.events.length>0?this.order():(this.expired=!0,this.onComplete.dispatch(this))}return this.expired&&this.autoDestroy?!1:!0},pause:function(){this.running&&!this.expired&&(this._pauseStarted=this.game.time.now,this.paused=!0)},resume:function(){if(this.running&&!this.expired){for(var a=this.game.time.now-this._pauseStarted,b=0;bthis._now?this.nextTick-this._now:0}}),Object.defineProperty(b.Timer.prototype,"length",{get:function(){return this.events.length}}),Object.defineProperty(b.Timer.prototype,"ms",{get:function(){return this._now}}),Object.defineProperty(b.Timer.prototype,"seconds",{get:function(){return.001*this._now}}),b.Timer.prototype.constructor=b.Timer,b.TimerEvent=function(a,b,c,d,e,f,g,h){this.timer=a,this.delay=b,this.tick=c,this.repeatCount=d-1,this.loop=e,this.callback=f,this.callbackContext=g,this.args=h,this.pendingDelete=!1},b.TimerEvent.prototype.constructor=b.TimerEvent,b.AnimationManager=function(a){this.sprite=a,this.game=a.game,this.currentFrame=null,this.updateIfVisible=!0,this.isLoaded=!1,this._frameData=null,this._anims={},this._outputFrames=[]},b.AnimationManager.prototype={loadFrameData:function(a){this._frameData=a,this.frame=0,this.isLoaded=!0},add:function(c,d,e,f,g){return null==this._frameData?(console.warn("No FrameData available for Phaser.Animation "+c),void 0):(e=e||60,"undefined"==typeof f&&(f=!1),"undefined"==typeof g&&(g=d&&"number"==typeof d[0]?!0:!1),null==this.sprite.events.onAnimationStart&&(this.sprite.events.onAnimationStart=new b.Signal,this.sprite.events.onAnimationComplete=new b.Signal,this.sprite.events.onAnimationLoop=new b.Signal),this._outputFrames.length=0,this._frameData.getFrameIndexes(d,g,this._outputFrames),this._anims[c]=new b.Animation(this.game,this.sprite,c,this._frameData,this._outputFrames,e,f),this.currentAnim=this._anims[c],this.currentFrame=this.currentAnim.currentFrame,this.sprite.setTexture(a.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1),this._anims[c])},validateFrames:function(a,b){"undefined"==typeof b&&(b=!0);for(var c=0;cthis._frameData.total)return!1}else if(this._frameData.checkFrameName(a[c])===!1)return!1;return!0},play:function(a,b,c,d){if(this._anims[a]){if(this.currentAnim!=this._anims[a])return this.currentAnim=this._anims[a],this.currentAnim.paused=!1,this.currentAnim.play(b,c,d);if(this.currentAnim.isPlaying===!1)return this.currentAnim.paused=!1,this.currentAnim.play(b,c,d)}},stop:function(a,b){"undefined"==typeof b&&(b=!1),"string"==typeof a?this._anims[a]&&(this.currentAnim=this._anims[a],this.currentAnim.stop(b)):this.currentAnim&&this.currentAnim.stop(b)},update:function(){return this.updateIfVisible&&this.sprite.visible===!1?!1:this.currentAnim&&this.currentAnim.update()===!0?(this.currentFrame=this.currentAnim.currentFrame,!0):!1},getAnimation:function(a){return"string"==typeof a&&this._anims[a]?this._anims[a]:null},refreshFrame:function(){this.sprite.setTexture(a.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1)},destroy:function(){this._anims={},this._frameData=null,this._frameIndex=0,this.currentAnim=null,this.currentFrame=null}},b.AnimationManager.prototype.constructor=b.AnimationManager,Object.defineProperty(b.AnimationManager.prototype,"frameData",{get:function(){return this._frameData}}),Object.defineProperty(b.AnimationManager.prototype,"frameTotal",{get:function(){return this._frameData?this._frameData.total:-1}}),Object.defineProperty(b.AnimationManager.prototype,"paused",{get:function(){return this.currentAnim.isPaused},set:function(a){this.currentAnim.paused=a}}),Object.defineProperty(b.AnimationManager.prototype,"frame",{get:function(){return this.currentFrame?this._frameIndex:void 0},set:function(b){"number"==typeof b&&this._frameData&&null!==this._frameData.getFrame(b)&&(this.currentFrame=this._frameData.getFrame(b),this._frameIndex=b,this.sprite.setTexture(a.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1))}}),Object.defineProperty(b.AnimationManager.prototype,"frameName",{get:function(){return this.currentFrame?this.currentFrame.name:void 0},set:function(b){"string"==typeof b&&this._frameData&&null!==this._frameData.getFrameByName(b)?(this.currentFrame=this._frameData.getFrameByName(b),this._frameIndex=this.currentFrame.index,this.sprite.setTexture(a.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1)):console.warn("Cannot set frameName: "+b)}}),b.Animation=function(a,b,c,d,e,f,g){this.game=a,this._parent=b,this._frameData=d,this.name=c,this._frames=[],this._frames=this._frames.concat(e),this.delay=1e3/f,this.looped=g,this.killOnComplete=!1,this.isFinished=!1,this.isPlaying=!1,this.isPaused=!1,this._pauseStartTime=0,this._frameIndex=0,this._frameDiff=0,this._frameSkip=1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex])},b.Animation.prototype={play:function(b,c,d){return"number"==typeof b&&(this.delay=1e3/b),"boolean"==typeof c&&(this.looped=c),"undefined"!=typeof d&&(this.killOnComplete=d),this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this._timeLastFrame=this.game.time.now,this._timeNextFrame=this.game.time.now+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this._parent.setTexture(a.TextureCache[this.currentFrame.uuid]),this._parent.__tilePattern&&(this._parent.__tilePattern=!1,this._parent.tilingTexture=!1),this._parent.events&&this._parent.events.onAnimationStart.dispatch(this._parent,this),this},restart:function(){this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this._timeLastFrame=this.game.time.now,this._timeNextFrame=this.game.time.now+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex])},stop:function(a){"undefined"==typeof a&&(a=!1),this.isPlaying=!1,this.isFinished=!0,this.paused=!1,a&&(this.currentFrame=this._frameData.getFrame(this._frames[0]))},update:function(){return this.isPaused?!1:this.isPlaying===!0&&this.game.time.now>=this._timeNextFrame?(this._frameSkip=1,this._frameDiff=this.game.time.now-this._timeNextFrame,this._timeLastFrame=this.game.time.now,this._frameDiff>this.delay&&(this._frameSkip=Math.floor(this._frameDiff/this.delay),this._frameDiff-=this._frameSkip*this.delay),this._timeNextFrame=this.game.time.now+(this.delay-this._frameDiff),this._frameIndex+=this._frameSkip,this._frameIndex>=this._frames.length?this.looped?(this._frameIndex%=this._frames.length,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&(this._parent.setTexture(a.TextureCache[this.currentFrame.uuid]),this._parent.__tilePattern&&(this._parent.__tilePattern=!1,this._parent.tilingTexture=!1)),this._parent.events.onAnimationLoop.dispatch(this._parent,this)):this.onComplete():(this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&(this._parent.setTexture(a.TextureCache[this.currentFrame.uuid]),this._parent.__tilePattern&&(this._parent.__tilePattern=!1,this._parent.tilingTexture=!1))),!0):!1},destroy:function(){this.game=null,this._parent=null,this._frames=null,this._frameData=null,this.currentFrame=null,this.isPlaying=!1},onComplete:function(){this.isPlaying=!1,this.isFinished=!0,this.paused=!1,this._parent.events&&this._parent.events.onAnimationComplete.dispatch(this._parent,this),this.killOnComplete&&this._parent.kill()}},b.Animation.prototype.constructor=b.Animation,Object.defineProperty(b.Animation.prototype,"paused",{get:function(){return this.isPaused},set:function(a){this.isPaused=a,a?this._pauseStartTime=this.game.time.now:this.isPlaying&&(this._timeNextFrame=this.game.time.now+this.delay)}}),Object.defineProperty(b.Animation.prototype,"frameTotal",{get:function(){return this._frames.length}}),Object.defineProperty(b.Animation.prototype,"frame",{get:function(){return null!==this.currentFrame?this.currentFrame.index:this._frameIndex},set:function(b){this.currentFrame=this._frameData.getFrame(b),null!==this.currentFrame&&(this._frameIndex=b,this._parent.setTexture(a.TextureCache[this.currentFrame.uuid]))}}),b.Animation.generateFrameNames=function(a,c,d,e,f){"undefined"==typeof e&&(e="");var g=[],h="";if(d>c)for(var i=c;d>=i;i++)h="number"==typeof f?b.Utils.pad(i.toString(),f,"0",1):i.toString(),h=a+h+e,g.push(h);else for(var i=c;i>=d;i--)h="number"==typeof f?b.Utils.pad(i.toString(),f,"0",1):i.toString(),h=a+h+e,g.push(h);return g},b.Frame=function(a,c,d,e,f,g,h){this.index=a,this.x=c,this.y=d,this.width=e,this.height=f,this.name=g,this.uuid=h,this.centerX=Math.floor(e/2),this.centerY=Math.floor(f/2),this.distance=b.Math.distance(0,0,e,f),this.rotated=!1,this.rotationDirection="cw",this.trimmed=!1,this.sourceSizeW=e,this.sourceSizeH=f,this.spriteSourceSizeX=0,this.spriteSourceSizeY=0,this.spriteSourceSizeW=0,this.spriteSourceSizeH=0},b.Frame.prototype={setTrim:function(a,b,c,d,e,f,g){this.trimmed=a,a&&(this.width=b,this.height=c,this.sourceSizeW=b,this.sourceSizeH=c,this.centerX=Math.floor(b/2),this.centerY=Math.floor(c/2),this.spriteSourceSizeX=d,this.spriteSourceSizeY=e,this.spriteSourceSizeW=f,this.spriteSourceSizeH=g)},getRect:function(a){return"undefined"==typeof a?a=new b.Rectangle(this.x,this.y,this.width,this.height):a.setTo(this.x,this.y,this.width,this.height),a}},b.Frame.prototype.constructor=b.Frame,b.FrameData=function(){this._frames=[],this._frameNames=[]},b.FrameData.prototype={addFrame:function(a){return a.index=this._frames.length,this._frames.push(a),""!==a.name&&(this._frameNames[a.name]=a.index),a},getFrame:function(a){return a>this._frames.length&&(a=0),this._frames[a]},getFrameByName:function(a){return"number"==typeof this._frameNames[a]?this._frames[this._frameNames[a]]:null},checkFrameName:function(a){return null==this._frameNames[a]?!1:!0},getFrameRange:function(a,b,c){"undefined"==typeof c&&(c=[]);for(var d=a;b>=d;d++)c.push(this._frames[d]);return c},getFrames:function(a,b,c){if("undefined"==typeof b&&(b=!0),"undefined"==typeof c&&(c=[]),"undefined"==typeof a||0===a.length)for(var d=0;dd;d++)b?c.push(this.getFrame(a[d])):c.push(this.getFrameByName(a[d]));return c},getFrameIndexes:function(a,b,c){if("undefined"==typeof b&&(b=!0),"undefined"==typeof c&&(c=[]),"undefined"==typeof a||0===a.length)for(var d=0,e=this._frames.length;e>d;d++)c.push(this._frames[d].index);else for(var d=0,e=a.length;e>d;d++)b?c.push(a[d]):this.getFrameByName(a[d])&&c.push(this.getFrameByName(a[d]).index);return c}},b.FrameData.prototype.constructor=b.FrameData,Object.defineProperty(b.FrameData.prototype,"total",{get:function(){return this._frames.length}}),b.AnimationParser={spriteSheet:function(c,d,e,f,g,h,i){var j=c.cache.getImage(d);if(null==j)return null;var k=j.width,l=j.height;0>=e&&(e=Math.floor(-k/Math.min(-1,e))),0>=f&&(f=Math.floor(-l/Math.min(-1,f)));var m=Math.round(k/e),n=Math.round(l/f),o=m*n;if(-1!==g&&(o=g),0===k||0===l||e>k||f>l||0===o)return console.warn("Phaser.AnimationParser.spriteSheet: width/height zero or width/height < given frameWidth/frameHeight"),null;for(var p=new b.FrameData,q=h,r=h,s=0;o>s;s++){var t=c.rnd.uuid();p.addFrame(new b.Frame(s,q,r,e,f,"",t)),a.TextureCache[t]=new a.Texture(a.BaseTextureCache[d],{x:q,y:r,width:e,height:f}),q+=e+i,q===k&&(q=h,r+=f+i)}return p},JSONData:function(c,d,e){if(!d.frames)return console.warn("Phaser.AnimationParser.JSONData: Invalid Texture Atlas JSON given, missing 'frames' array"),console.log(d),void 0;for(var f,g=new b.FrameData,h=d.frames,i=0;i tag"),void 0;for(var f,g,h,i,j,k,l,m,n,o,p,q,r=new b.FrameData,s=d.getElementsByTagName("SubTexture"),t=0;t0)for(var c=0;c0)for(var c=0;c0?(this._fileIndex=0,this._progressChunk=100/this._fileList.length,this.loadFile()):(this.progress=100,this.progressFloat=100,this.hasLoaded=!0,this.onLoadComplete.dispatch()))},loadFile:function(){if(!this._fileList[this._fileIndex])return console.warn("Phaser.Loader loadFile invalid index "+this._fileIndex),void 0;var a=this._fileList[this._fileIndex],c=this;switch(a.type){case"image":case"spritesheet":case"textureatlas":case"bitmapfont":a.data=new Image,a.data.name=a.key,a.data.onload=function(){return c.fileComplete(c._fileIndex)},a.data.onerror=function(){return c.fileError(c._fileIndex)},this.crossOrigin&&(a.data.crossOrigin=this.crossOrigin),a.data.src=this.baseURL+a.url;break;case"audio":a.url=this.getAudioURL(a.url),null!==a.url?this.game.sound.usingWebAudio?(this._xhr.open("GET",this.baseURL+a.url,!0),this._xhr.responseType="arraybuffer",this._xhr.onload=function(){return c.fileComplete(c._fileIndex)},this._xhr.onerror=function(){return c.fileError(c._fileIndex)},this._xhr.send()):this.game.sound.usingAudioTag&&(this.game.sound.touchLocked?(a.data=new Audio,a.data.name=a.key,a.data.preload="auto",a.data.src=this.baseURL+a.url,this.fileComplete(this._fileIndex)):(a.data=new Audio,a.data.name=a.key,a.data.onerror=function(){return c.fileError(c._fileIndex)},a.data.preload="auto",a.data.src=this.baseURL+a.url,a.data.addEventListener("canplaythrough",b.GAMES[this.game.id].load.fileComplete(this._fileIndex),!1),a.data.load())):this.fileError(this._fileIndex);break;case"tilemap":if(this._xhr.open("GET",this.baseURL+a.url,!0),this._xhr.responseType="text",a.format===b.Tilemap.TILED_JSON)this._xhr.onload=function(){return c.jsonLoadComplete(c._fileIndex)};else{if(a.format!==b.Tilemap.CSV)throw new Error("Phaser.Loader. Invalid Tilemap format: "+a.format);this._xhr.onload=function(){return c.csvLoadComplete(c._fileIndex)}}this._xhr.onerror=function(){return c.dataLoadError(c._fileIndex)},this._xhr.send();break;case"text":case"script":case"physics":this._xhr.open("GET",this.baseURL+a.url,!0),this._xhr.responseType="text",this._xhr.onload=function(){return c.fileComplete(c._fileIndex)},this._xhr.onerror=function(){return c.fileError(c._fileIndex)},this._xhr.send();break;case"binary":this._xhr.open("GET",this.baseURL+a.url,!0),this._xhr.responseType="arraybuffer",this._xhr.onload=function(){return c.fileComplete(c._fileIndex)},this._xhr.onerror=function(){return c.fileError(c._fileIndex)},this._xhr.send()}},getAudioURL:function(a){var b;"string"==typeof a&&(a=[a]);for(var c=0;c100&&(this.progress=100),null!==this.preloadSprite&&(0===this.preloadSprite.direction?this.preloadSprite.crop.width=Math.floor(this.preloadSprite.width/100*this.progress):this.preloadSprite.crop.height=Math.floor(this.preloadSprite.height/100*this.progress)),this.onFileComplete.dispatch(this.progress,this._fileList[a].key,b,this.totalLoadedFiles(),this._fileList.length),this.totalQueuedFiles()>0?(this._fileIndex++,this.loadFile()):(this.hasLoaded=!0,this.isLoading=!1,this.removeAll(),this.onLoadComplete.dispatch())},totalLoadedFiles:function(){for(var a=0,b=0;b=this.durationMS&&(this.usingWebAudio?this.loop?(this.onLoop.dispatch(this),""===this.currentMarker?(this.currentTime=0,this.startTime=this.game.time.now):this.play(this.currentMarker,0,this.volume,!0,!0)):this.stop():this.loop?(this.onLoop.dispatch(this),this.play(this.currentMarker,0,this.volume,!0,!0)):this.stop()))},play:function(a,b,c,d,e){if(a=a||"",b=b||0,"undefined"==typeof c&&(c=this._volume),"undefined"==typeof d&&(d=!1),"undefined"==typeof e&&(e=!0),this.isPlaying!==!0||e!==!1||this.override!==!1){if(this.isPlaying&&this.override&&(this.usingWebAudio?"undefined"==typeof this._sound.stop?this._sound.noteOff(0):this._sound.stop(0):this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0)),this.currentMarker=a,""!==a){if(!this.markers[a])return console.warn("Phaser.Sound.play: audio marker "+a+" doesn't exist"),void 0;this.position=this.markers[a].start,this.volume=this.markers[a].volume,this.loop=this.markers[a].loop,this.duration=this.markers[a].duration,this.durationMS=this.markers[a].durationMS,this._tempMarker=a,this._tempPosition=this.position,this._tempVolume=this.volume,this._tempLoop=this.loop}else this.position=b,this.volume=c,this.loop=d,this.duration=0,this.durationMS=0,this._tempMarker=a,this._tempPosition=b,this._tempVolume=c,this._tempLoop=d;this.usingWebAudio?this.game.cache.isSoundDecoded(this.key)?(null==this._buffer&&(this._buffer=this.game.cache.getSoundData(this.key)),this._sound=this.context.createBufferSource(),this._sound.buffer=this._buffer,this.externalNode?this._sound.connect(this.externalNode.input):this._sound.connect(this.gainNode),this.totalDuration=this._sound.buffer.duration,0===this.duration&&(this.duration=this.totalDuration,this.durationMS=1e3*this.totalDuration),this.loop&&""===a&&(this._sound.loop=!0),"undefined"==typeof this._sound.start?this._sound.noteGrainOn(0,this.position,this.duration):this._sound.start(0,this.position,this.duration),this.isPlaying=!0,this.startTime=this.game.time.now,this.currentTime=0,this.stopTime=this.startTime+this.durationMS,this.onPlay.dispatch(this)):(this.pendingPlayback=!0,this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).isDecoding===!1&&this.game.sound.decode(this.key,this)):this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).locked?(this.game.cache.reloadSound(this.key),this.pendingPlayback=!0):this._sound&&(this.game.device.cocoonJS||4===this._sound.readyState)?(this._sound.play(),this.totalDuration=this._sound.duration,0===this.duration&&(this.duration=this.totalDuration,this.durationMS=1e3*this.totalDuration),this._sound.currentTime=this.position,this._sound.muted=this._muted,this._sound.volume=this._muted?0:this._volume,this.isPlaying=!0,this.startTime=this.game.time.now,this.currentTime=0,this.stopTime=this.startTime+this.durationMS,this.onPlay.dispatch(this)):this.pendingPlayback=!0}},restart:function(a,b,c,d){a=a||"",b=b||0,c=c||1,"undefined"==typeof d&&(d=!1),this.play(a,b,c,d,!0)},pause:function(){this.isPlaying&&this._sound&&(this.stop(),this.isPlaying=!1,this.paused=!0,this.pausedPosition=this.currentTime,this.pausedTime=this.game.time.now,this.onPause.dispatch(this))},resume:function(){if(this.paused&&this._sound){if(this.usingWebAudio){var a=this.position+this.pausedPosition/1e3;this._sound=this.context.createBufferSource(),this._sound.buffer=this._buffer,this.externalNode?this._sound.connect(this.externalNode.input):this._sound.connect(this.gainNode),this.loop&&(this._sound.loop=!0),"undefined"==typeof this._sound.start?this._sound.noteGrainOn(0,a,this.duration):this._sound.start(0,a,this.duration)}else this._sound.play();this.isPlaying=!0,this.paused=!1,this.startTime+=this.game.time.now-this.pausedTime,this.onResume.dispatch(this)}},stop:function(){this.isPlaying&&this._sound&&(this.usingWebAudio?"undefined"==typeof this._sound.stop?this._sound.noteOff(0):this._sound.stop(0):this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0)),this.isPlaying=!1;var a=this.currentMarker;this.currentMarker="",this.onStop.dispatch(this,a)}},b.Sound.prototype.constructor=b.Sound,Object.defineProperty(b.Sound.prototype,"isDecoding",{get:function(){return this.game.cache.getSound(this.key).isDecoding}}),Object.defineProperty(b.Sound.prototype,"isDecoded",{get:function(){return this.game.cache.isSoundDecoded(this.key)}}),Object.defineProperty(b.Sound.prototype,"mute",{get:function(){return this._muted},set:function(a){a=a||null,a?(this._muted=!0,this.usingWebAudio?(this._muteVolume=this.gainNode.gain.value,this.gainNode.gain.value=0):this.usingAudioTag&&this._sound&&(this._muteVolume=this._sound.volume,this._sound.volume=0)):(this._muted=!1,this.usingWebAudio?this.gainNode.gain.value=this._muteVolume:this.usingAudioTag&&this._sound&&(this._sound.volume=this._muteVolume)),this.onMute.dispatch(this)}}),Object.defineProperty(b.Sound.prototype,"volume",{get:function(){return this._volume},set:function(a){this.usingWebAudio?(this._volume=a,this.gainNode.gain.value=a):this.usingAudioTag&&this._sound&&a>=0&&1>=a&&(this._volume=a,this._sound.volume=a)}}),b.SoundManager=function(a){this.game=a,this.onSoundDecode=new b.Signal,this._muted=!1,this._unlockSource=null,this._volume=1,this._sounds=[],this.context=null,this.usingWebAudio=!0,this.usingAudioTag=!1,this.noAudio=!1,this.connectToMaster=!0,this.touchLocked=!1,this.channels=32},b.SoundManager.prototype={boot:function(){if(this.game.device.iOS&&this.game.device.webAudio===!1&&(this.channels=1),this.game.device.iOS||window.PhaserGlobal&&window.PhaserGlobal.fakeiOSTouchLock?(this.game.input.touch.callbackContext=this,this.game.input.touch.touchStartCallback=this.unlock,this.game.input.mouse.callbackContext=this,this.game.input.mouse.mouseDownCallback=this.unlock,this.touchLocked=!0):this.touchLocked=!1,window.PhaserGlobal){if(window.PhaserGlobal.disableAudio===!0)return this.usingWebAudio=!1,this.noAudio=!0,void 0;if(window.PhaserGlobal.disableWebAudio===!0)return this.usingWebAudio=!1,this.usingAudioTag=!0,this.noAudio=!1,void 0}window.AudioContext?this.context=new window.AudioContext:window.webkitAudioContext?this.context=new window.webkitAudioContext:window.Audio?(this.usingWebAudio=!1,this.usingAudioTag=!0):(this.usingWebAudio=!1,this.noAudio=!0),null!==this.context&&(this.masterGain="undefined"==typeof this.context.createGain?this.context.createGainNode():this.context.createGain(),this.masterGain.gain.value=1,this.masterGain.connect(this.context.destination)) +},unlock:function(){if(this.touchLocked!==!1)if(this.game.device.webAudio===!1||window.PhaserGlobal&&window.PhaserGlobal.disableWebAudio===!0)this.touchLocked=!1,this._unlockSource=null,this.game.input.touch.callbackContext=null,this.game.input.touch.touchStartCallback=null,this.game.input.mouse.callbackContext=null,this.game.input.mouse.mouseDownCallback=null;else{var a=this.context.createBuffer(1,1,22050);this._unlockSource=this.context.createBufferSource(),this._unlockSource.buffer=a,this._unlockSource.connect(this.context.destination),this._unlockSource.noteOn(0)}},stopAll:function(){for(var a=0;a255)return b.Color.getColor(255,255,255);if(a>c)return b.Color.getColor(255,255,255);var e=a+Math.round(Math.random()*(c-a)),f=a+Math.round(Math.random()*(c-a)),g=a+Math.round(Math.random()*(c-a));return b.Color.getColor32(d,e,f,g)},getRGB:function(a){return{alpha:a>>>24,red:255&a>>16,green:255&a>>8,blue:255&a}},getWebRGB:function(a){var b=(a>>>24)/255,c=255&a>>16,d=255&a>>8,e=255&a;return"rgba("+c.toString()+","+d.toString()+","+e.toString()+","+b.toString()+")"},getAlpha:function(a){return a>>>24},getAlphaFloat:function(a){return(a>>>24)/255},getRed:function(a){return 255&a>>16},getGreen:function(a){return 255&a>>8},getBlue:function(a){return 255&a}},b.Physics={},b.Physics.LIME_CORONA_JSON=0,p2.Body.prototype.parent=null,b.Physics.World=function(a){this.game=a,this.onBodyAdded=new b.Signal,this.onBodyRemoved=new b.Signal,this.bounds=null,p2.World.call(this,{gravity:[0,0]}),this.on("addBody",this.addBodyHandler),this.on("removeBody",this.removeBodyHandler),this.on("postStep",this.postStepHandler),this.on("postBroadphase",this.postBroadphaseHandler),this.setBoundsToWorld(!0,!0,!0,!0)},b.Physics.World.prototype=Object.create(p2.World.prototype),b.Physics.World.prototype.constructor=b.Physics.World,b.Physics.World.prototype.addBodyHandler=function(a){a.body.parent&&this.onBodyAdded.dispatch(a.body.parent,a.target)},b.Physics.World.prototype.removeBodyHandler=function(a){a.body.parent&&this.onBodyRemoved.dispatch(a.body.parent,a.target)},b.Physics.World.prototype.postStepHandler=function(){},b.Physics.World.prototype.postBroadphaseHandler=function(a){for(var b=0;b=0;a--){var b=this.data.shapes[a];this.data.removeShape(b)}},addShape:function(a,b,c,d){return"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=0),"undefined"==typeof d&&(d=0),this.data.addShape(a,[this.px2p(b),this.px2p(c)],d),a},addCircle:function(a,b,c,d){var e=new p2.Circle(this.px2p(a));return this.addShape(e,b,c,d)},addRectangle:function(a,b,c,d,e){var f=new p2.Rectangle(this.px2p(a),this.px2p(b));return this.addShape(f,c,d,e)},addPlane:function(a,b,c,d,e){var f=new p2.Plane;return this.addShape(f,c,d,e)},addParticle:function(a,b,c,d,e){var f=new p2.Particle;return this.addShape(f,c,d,e)},addLine:function(a,b,c,d){var e=new p2.Line(this.px2p(a));return this.addShape(e,b,c,d)},addCapsule:function(a,b,c,d,e){var f=new p2.Capsule(this.px2p(a),b);return this.addShape(f,c,d,e)},addPolygon:function(a,b){a=a||{},b=Array.prototype.slice.call(arguments,1);var c=[];if(1===b.length&&Array.isArray(b[0]))c=b[0].slice(0);else if(Array.isArray(b[0]))c=b[0].slice(0);else if("number"==typeof b[0])for(var d=0,e=b.length;e>d;d+=2)c.push([b[d],b[d+1]]);var f=c.length-1;c[f][0]===c[0][0]&&c[f][1]===c[0][1]&&c.pop();for(var g=0;gf;f+=2)e.push([d.shape[f],d.shape[f+1]]);return this.addPolygon(c,e)}return!1},loadData:function(a,b){var c=game.cache.getPhysicsData(a,b);c&&c.shape&&(this.mass=c.density,this.loadPolygon(a,b))},p2px:function(a){return a*=-20},px2p:function(a){return a*-.05}},b.Physics.Body.prototype.constructor=b.Physics.Body,Object.defineProperty(b.Physics.Body.prototype,"static",{get:function(){return this.data.motionState===b.STATIC},set:function(a){a&&this.data.motionState!==b.STATIC?(this.data.motionState=b.STATIC,this.mass=0):a||this.data.motionState!==b.STATIC||(this.data.motionState=b.DYNAMIC,0===this.mass&&(this.mass=1))}}),Object.defineProperty(b.Physics.Body.prototype,"dynamic",{get:function(){return this.data.motionState===b.DYNAMIC},set:function(a){a&&this.data.motionState!==b.DYNAMIC?(this.data.motionState=b.DYNAMIC,0===this.mass&&(this.mass=1)):a||this.data.motionState!==b.DYNAMIC||(this.data.motionState=b.STATIC,this.mass=0)}}),Object.defineProperty(b.Physics.Body.prototype,"kinematic",{get:function(){return this.data.motionState===b.KINEMATIC},set:function(a){a&&this.data.motionState!==b.KINEMATIC?this.data.motionState=b.KINEMATIC:a||this.data.motionState!==b.KINEMATIC||(this.data.motionState=b.STATIC,this.mass=0)}}),Object.defineProperty(b.Physics.Body.prototype,"allowSleep",{get:function(){return this.data.allowSleep},set:function(a){a!==this.data.allowSleep&&(this.data.allowSleep=a)}}),Object.defineProperty(b.Physics.Body.prototype,"angle",{get:function(){return b.Math.wrapAngle(b.Math.radToDeg(this.data.angle))},set:function(a){this.data.angle=b.Math.degToRad(b.Math.wrapAngle(a))}}),Object.defineProperty(b.Physics.Body.prototype,"angularDamping",{get:function(){return this.data.angularDamping},set:function(a){this.data.angularDamping=a}}),Object.defineProperty(b.Physics.Body.prototype,"angularForce",{get:function(){return this.data.angularForce},set:function(a){this.data.angularForce=a}}),Object.defineProperty(b.Physics.Body.prototype,"angularVelocity",{get:function(){return this.data.angularVelocity},set:function(a){this.data.angularVelocity=a}}),Object.defineProperty(b.Physics.Body.prototype,"damping",{get:function(){return this.data.damping},set:function(a){this.data.damping=a}}),Object.defineProperty(b.Physics.Body.prototype,"fixedRotation",{get:function(){return this.data.fixedRotation},set:function(a){a!==this.data.fixedRotation&&(this.data.fixedRotation=a)}}),Object.defineProperty(b.Physics.Body.prototype,"inertia",{get:function(){return this.data.inertia},set:function(a){this.data.inertia=a}}),Object.defineProperty(b.Physics.Body.prototype,"mass",{get:function(){return this.data.mass},set:function(a){a!==this.data.mass&&(this.data.mass=a,this.data.updateMassProperties())}}),Object.defineProperty(b.Physics.Body.prototype,"motionState",{get:function(){return this.data.motionState},set:function(a){a!==this.data.motionState&&(this.data.motionState=a)}}),Object.defineProperty(b.Physics.Body.prototype,"rotation",{get:function(){return this.data.angle},set:function(a){this.data.angle=a}}),Object.defineProperty(b.Physics.Body.prototype,"sleepSpeedLimit",{get:function(){return this.data.sleepSpeedLimit},set:function(a){this.data.sleepSpeedLimit=a}}),Object.defineProperty(b.Physics.Body.prototype,"x",{get:function(){return this.p2px(this.data.position[0])},set:function(a){this.data.position[0]=this.px2p(a)}}),Object.defineProperty(b.Physics.Body.prototype,"y",{get:function(){return this.p2px(this.data.position[1])},set:function(a){this.data.position[1]=this.px2p(a)}}),b.Physics.Spring=function(a,b,c,d,e,f,g,h,i,j){this.game=a,"undefined"==typeof d&&(d=1),"undefined"==typeof e&&(e=100),"undefined"==typeof f&&(f=1);var k={restLength:d,stiffness:e,damping:f};"undefined"!=typeof g&&null!==g&&(k.worldAnchorA=[a.math.px2p(g[0]),a.math.px2p(g[1])]),"undefined"!=typeof h&&null!==h&&(k.worldAnchorB=[a.math.px2p(h[0]),a.math.px2p(h[1])]),"undefined"!=typeof i&&null!==i&&(k.localAnchorA=[a.math.px2p(i[0]),a.math.px2p(i[1])]),"undefined"!=typeof j&&null!==j&&(k.localAnchorB=[a.math.px2p(j[0]),a.math.px2p(j[1])]),p2.Spring.call(this,b,c,k)},b.Physics.Spring.prototype=Object.create(p2.Spring.prototype),b.Physics.Spring.prototype.constructor=b.Physics.Spring,b.Particles=function(a){this.game=a,this.emitters={},this.ID=0},b.Particles.prototype={add:function(a){return this.emitters[a.name]=a,a},remove:function(a){delete this.emitters[a.name]},update:function(){for(var a in this.emitters)this.emitters[a].exists&&this.emitters[a].update()}},b.Particles.prototype.constructor=b.Particles,b.Particles.Arcade={},b.Particles.Arcade.Emitter=function(a,c,d,e){this.maxParticles=e||50,b.Group.call(this,a),this.name="emitter"+this.game.particles.ID++,this.type=b.EMITTER,this.x=0,this.y=0,this.width=1,this.height=1,this.minParticleSpeed=new b.Point(-100,-100),this.maxParticleSpeed=new b.Point(100,100),this.minParticleScale=1,this.maxParticleScale=1,this.minRotation=-360,this.maxRotation=360,this.gravity=100,this.particleClass=null,this.particleFriction=0,this.angularDrag=0,this.frequency=100,this.lifespan=2e3,this.bounce=new b.Point,this._quantity=0,this._timer=0,this._counter=0,this._explode=!0,this.on=!1,this.exists=!0,this.emitX=c,this.emitY=d},b.Particles.Arcade.Emitter.prototype=Object.create(b.Group.prototype),b.Particles.Arcade.Emitter.prototype.constructor=b.Particles.Arcade.Emitter,b.Particles.Arcade.Emitter.prototype.update=function(){if(this.on)if(this._explode){this._counter=0;do this.emitParticle(),this._counter++;while(this._counter=this._timer&&(this.emitParticle(),this._counter++,this._quantity>0&&this._counter>=this._quantity&&(this.on=!1),this._timer=this.game.time.now+this.frequency)},b.Particles.Arcade.Emitter.prototype.makeParticles=function(a,c,d,e,f){"undefined"==typeof c&&(c=0),"undefined"==typeof d&&(d=this.maxParticles),"undefined"==typeof e&&(e=!1),"undefined"==typeof f&&(f=!1);for(var g,h=0,i=a,j=c;d>h;)null===this.particleClass&&("object"==typeof a&&(i=this.game.rnd.pick(a)),"object"==typeof c&&(j=this.game.rnd.pick(c)),g=new b.Sprite(this.game,0,0,i,j)),e?(g.body.checkCollision.any=!0,g.body.checkCollision.none=!1):g.body.checkCollision.none=!0,g.body.collideWorldBounds=f,g.exists=!1,g.visible=!1,g.anchor.setTo(.5,.5),this.add(g),h++;return this},b.Particles.Arcade.Emitter.prototype.kill=function(){this.on=!1,this.alive=!1,this.exists=!1},b.Particles.Arcade.Emitter.prototype.revive=function(){this.alive=!0,this.exists=!0},b.Particles.Arcade.Emitter.prototype.start=function(a,b,c,d){"undefined"==typeof a&&(a=!0),"undefined"==typeof b&&(b=0),"undefined"==typeof c&&(c=250),"undefined"==typeof d&&(d=0),this.revive(),this.visible=!0,this.on=!0,this._explode=a,this.lifespan=b,this.frequency=c,a?this._quantity=d:this._quantity+=d,this._counter=0,this._timer=this.game.time.now+c},b.Particles.Arcade.Emitter.prototype.emitParticle=function(){var a=this.getFirstExists(!1);if(null!=a){if(this.width>1||this.height>1?a.reset(this.game.rnd.integerInRange(this.left,this.right),this.game.rnd.integerInRange(this.top,this.bottom)):a.reset(this.emitX,this.emitY),a.lifespan=this.lifespan,a.body.bounce.setTo(this.bounce.x,this.bounce.y),a.body.velocity.x=this.minParticleSpeed.x!=this.maxParticleSpeed.x?this.game.rnd.integerInRange(this.minParticleSpeed.x,this.maxParticleSpeed.x):this.minParticleSpeed.x,a.body.velocity.y=this.minParticleSpeed.y!=this.maxParticleSpeed.y?this.game.rnd.integerInRange(this.minParticleSpeed.y,this.maxParticleSpeed.y):this.minParticleSpeed.y,a.body.gravity.y=this.gravity,a.body.angularVelocity=this.minRotation!=this.maxRotation?this.game.rnd.integerInRange(this.minRotation,this.maxRotation):this.minRotation,1!==this.minParticleScale||1!==this.maxParticleScale){var b=this.game.rnd.realInRange(this.minParticleScale,this.maxParticleScale);a.scale.setTo(b,b)}a.body.friction=this.particleFriction,a.body.angularDrag=this.angularDrag}},b.Particles.Arcade.Emitter.prototype.setSize=function(a,b){this.width=a,this.height=b},b.Particles.Arcade.Emitter.prototype.setXSpeed=function(a,b){a=a||0,b=b||0,this.minParticleSpeed.x=a,this.maxParticleSpeed.x=b},b.Particles.Arcade.Emitter.prototype.setYSpeed=function(a,b){a=a||0,b=b||0,this.minParticleSpeed.y=a,this.maxParticleSpeed.y=b},b.Particles.Arcade.Emitter.prototype.setRotation=function(a,b){a=a||0,b=b||0,this.minRotation=a,this.maxRotation=b},b.Particles.Arcade.Emitter.prototype.at=function(a){a.center&&(this.emitX=a.center.x,this.emitY=a.center.y)},Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"x",{get:function(){return this.emitX},set:function(a){this.emitX=a}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"y",{get:function(){return this.emitY},set:function(a){this.emitY=a}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"left",{get:function(){return Math.floor(this.x-this.width/2)}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"right",{get:function(){return Math.floor(this.x+this.width/2)}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"top",{get:function(){return Math.floor(this.y-this.height/2)}}),Object.defineProperty(b.Particles.Arcade.Emitter.prototype,"bottom",{get:function(){return Math.floor(this.y+this.height/2)}}),b.Tile=function(a,b,c,d,e,f){this.layer=a,this.index=b,this.x=c,this.y=d,this.width=e,this.height=f,this.alpha=1,this.properties={},this.scanned=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this.collides=!1,this.collideNone=!0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.collisionCallback=null,this.collisionCallbackContext=this},b.Tile.prototype={setCollisionCallback:function(a,b){this.collisionCallback=a,this.collisionCallbackContext=b +},destroy:function(){this.collisionCallback=null,this.collisionCallbackContext=null,this.properties=null},setCollision:function(a,b,c,d){this.collideLeft=a,this.collideRight=b,this.collideUp=c,this.collideDown=d,this.collideNone=a||b||c||d?!1:!0},resetCollision:function(){this.collideNone=!0,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1},copy:function(a){this.index=a.index,this.alpha=a.alpha,this.properties=a.properties,this.collides=a.collides,this.collideNone=a.collideNone,this.collideUp=a.collideUp,this.collideDown=a.collideDown,this.collideLeft=a.collideLeft,this.collideRight=a.collideRight,this.collisionCallback=a.collisionCallback,this.collisionCallbackContext=a.collisionCallbackContext}},b.Tile.prototype.constructor=b.Tile,Object.defineProperty(b.Tile.prototype,"canCollide",{get:function(){return this.collides||this.collisionCallback||this.layer.callbacks[this.index]}}),Object.defineProperty(b.Tile.prototype,"left",{get:function(){return this.x}}),Object.defineProperty(b.Tile.prototype,"right",{get:function(){return this.x+this.width}}),Object.defineProperty(b.Tile.prototype,"top",{get:function(){return this.y}}),Object.defineProperty(b.Tile.prototype,"bottom",{get:function(){return this.y+this.height}}),b.Tilemap=function(a,c){this.game=a,this.key=c;var d=b.TilemapParser.parse(this.game,c);null!==d&&(this.width=d.width,this.height=d.height,this.tileWidth=d.tileWidth,this.tileHeight=d.tileHeight,this.orientation=d.orientation,this.version=d.version,this.properties=d.properties,this.widthInPixels=d.widthInPixels,this.heightInPixels=d.heightInPixels,this.layers=d.layers,this.tilesets=d.tilesets,this.tiles=d.tiles,this.objects=d.objects,this.collision=d.collision,this.images=d.images,this.currentLayer=0,this.debugMap=[],this._results=[],this._tempA=0,this._tempB=0)},b.Tilemap.CSV=0,b.Tilemap.TILED_JSON=1,b.Tilemap.prototype={create:function(a,c,d){for(var e=[],f=0;d>f;f++){e[f]=[];for(var g=0;c>g;g++)e[f][g]=0}this.layers.push({name:a,width:c,height:d,alpha:1,visible:!0,tileMargin:0,tileSpacing:0,format:b.Tilemap.CSV,data:e,indexes:[],dirty:!0}),this.currentLayer=this.layers.length-1},addTilesetImage:function(a,b){if("undefined"==typeof b){if("string"!=typeof a)return!1;b=a}return"string"==typeof a&&(a=this.getTilesetIndex(a)),this.tilesets[a]?(this.tilesets[a].image=this.game.cache.getImage(b),!0):!1},createFromObjects:function(a,b,c,d,e,f,g){if("undefined"==typeof e&&(e=!0),"undefined"==typeof f&&(f=!0),"undefined"==typeof g&&(g=this.game.world),!this.objects[a])return console.warn("Tilemap.createFromObjects: Invalid objectgroup name given: "+a),void 0;for(var h,i=0,j=this.objects[a].length;j>i;i++)if(this.objects[a][i].gid===b){h=g.create(this.objects[a][i].x,this.objects[a][i].y,c,d,e),h.anchor.setTo(0,1),h.name=this.objects[a][i].name,h.visible=this.objects[a][i].visible,h.autoCull=f;for(property in this.objects[a][i].properties)g.set(h,property,this.objects[a][i].properties[property],!1,!1,0)}},clearPhysicsBodies:function(a){a=this.getLayer(a);for(var b=this.layers[a].bodies.length;b--;)this.layers[a].bodies[b].destroy()},generateCollisionData:function(a,b){a=this.getLayer(a),"undefined"==typeof b&&(b=!0),this.layers[a].bodies.length>0&&this.clearPhysicsBodies(a),this.layers[a].bodies.length=[];for(var c=0,d=0,e=0,f=0,g=this.layers[a].height;g>f;f++){c=0;for(var h=0,i=this.layers[a].width;i>h;h++){var j=this.layers[a].data[f][h];if(j)if(right=this.getTileRight(a,h,f),0===c&&(d=j.x*j.width,e=j.y*j.height,c=j.width),right&&right.collides)c+=j.width;else{var k=this.game.physics.createBody(d,e,0,!1);k.addRectangle(c,j.height,c/2,j.height/2,0),b&&this.game.physics.addBody(k.data),this.layers[a].bodies.push(k),c=0}}}return this.layers[a].bodies},createCollisionObjects:function(a,b){"undefined"==typeof b&&(b=!0);for(var c=[],d=0,e=this.collision[a].length;e>d;d++){var f=this.collision[a][d],g=this.game.physics.createBody(f.x,f.y,0,b,{},f.polyline);g&&c.push(g)}return c},createLayer:function(a,c,d,e){"undefined"==typeof c&&(c=this.game.width),"undefined"==typeof d&&(d=this.game.height),"undefined"==typeof e&&(e=this.game.world);var f=a;return"string"==typeof a&&(f=this.getLayerIndex(a)),null===f||f>this.layers.length?(console.warn("Tilemap.createLayer: Invalid layer ID given: "+f),void 0):e.add(new b.TilemapLayer(this.game,this,f,c,d))},getIndex:function(a,b){for(var c=0;ce;e++)this.layers[d].callbacks[a[e]]={callback:b,callbackContext:c}},setTileLocationCallback:function(a,b,c,d,e,f,g){if(g=this.getLayer(g),this.copy(a,b,c,d,g),!(this._results.length<2))for(var h=1;hd;d++)this.setCollisionByIndex(a[d],b,c,!1);this.calculateFaces(c)},setCollisionBetween:function(a,b,c,d){if("undefined"==typeof c&&(c=!0),d=this.getLayer(d),!(a>b)){for(var e=a;b>=e;e++)this.setCollisionByIndex(e,c,d,!1);this.calculateFaces(d)}},setCollisionByExclusion:function(a,b,c){"undefined"==typeof b&&(b=!0),c=this.getLayer(c);for(var d=0,e=this.tiles.length;e>d;d++)-1===a.indexOf(d)&&this.setCollisionByIndex(d,b,c,!1);this.calculateFaces(c)},setCollisionByIndex:function(a,b,c,d){"undefined"==typeof b&&(b=!0),"undefined"==typeof c&&(c=this.currentLayer),"undefined"==typeof d&&(d=!0);for(var e=0;ef;f++)for(var h=0,i=this.layers[a].width;i>h;h++){var j=this.layers[a].data[f][h];j&&(b=this.getTileAbove(a,h,f),c=this.getTileBelow(a,h,f),d=this.getTileLeft(a,h,f),e=this.getTileRight(a,h,f),b&&b.collides&&(j.faceTop=!1),c&&c.collides&&(j.faceBottom=!1),d&&d.collides&&(j.faceLeft=!1),e&&e.collides&&(j.faceRight=!1))}},getTileAbove:function(a,b,c){return c>0?this.layers[a].data[c-1][b]:null},getTileBelow:function(a,b,c){return c0?this.layers[a].data[c][b-1]:null},getTileRight:function(a,b,c){return b=0&&c=0&&d=0&&a=0&&ba&&(a=0),0>b&&(b=0),c>this.layers[e].width&&(c=this.layers[e].width),d>this.layers[e].height&&(d=this.layers[e].height),this._results.length=0,this._results.push({x:a,y:b,width:c,height:d,layer:e});for(var f=b;b+d>f;f++)for(var g=a;a+c>g;g++)this._results.push(this.layers[e].data[f][g]);return this._results},paste:function(a,b,c,d){if("undefined"==typeof a&&(a=0),"undefined"==typeof b&&(b=0),d=this.getLayer(d),c&&!(c.length<2)){for(var e=c[1].x-a,f=c[1].y-b,g=1;g1?this.debugMap[this.layers[this.currentLayer].data[c][d]]?b.push("background: "+this.debugMap[this.layers[this.currentLayer].data[c][d]]):b.push("background: #ffffff"):b.push("background: rgb(0, 0, 0)");a+="\n"}b[0]=a,console.log.apply(console,b)},destroy:function(){this.removeAllLayers(),this.data=[],this.game=null}},b.Tilemap.prototype.constructor=b.Tilemap,b.TilemapLayer=function(c,d,e,f,g){this.game=c,this.map=d,this.index=e,this.layer=d.layers[e],this.canvas=b.Canvas.create(f,g),this.context=this.canvas.getContext("2d"),this.baseTexture=new a.BaseTexture(this.canvas),this.texture=new a.Texture(this.baseTexture),this.textureFrame=new b.Frame(0,0,0,f,g,"tilemapLayer",c.rnd.uuid()),b.Sprite.call(this,this.game,0,0,this.texture,this.textureFrame),this.name="",this.type=b.TILEMAPLAYER,this.fixedToCamera=!0,this.cameraOffset=new b.Point(0,0),this.tileColor="rgb(255, 255, 255)",this.debug=!1,this.debugAlpha=.5,this.debugColor="rgba(0, 255, 0, 1)",this.debugFill=!1,this.debugFillColor="rgba(0, 255, 0, 0.2)",this.debugCallbackColor="rgba(255, 0, 0, 1)",this.scrollFactorX=1,this.scrollFactorY=1,this.dirty=!0,this._cw=d.tileWidth,this._ch=d.tileHeight,this._ga=1,this._dx=0,this._dy=0,this._dw=0,this._dh=0,this._tx=0,this._ty=0,this._tw=0,this._th=0,this._tl=0,this._maxX=0,this._maxY=0,this._startX=0,this._startY=0,this._results=[],this._x=0,this._y=0,this._prevX=0,this._prevY=0,this.updateMax()},b.TilemapLayer.prototype=Object.create(b.Sprite.prototype),b.TilemapLayer.prototype=b.Utils.extend(!0,b.TilemapLayer.prototype,b.Sprite.prototype,a.Sprite.prototype),b.TilemapLayer.prototype.constructor=b.TilemapLayer,b.TilemapLayer.prototype.postUpdate=function(){b.Sprite.prototype.postUpdate.call(this),this.scrollX=this.game.camera.x*this.scrollFactorX,this.scrollY=this.game.camera.y*this.scrollFactorY,this.render()},b.TilemapLayer.prototype.resizeWorld=function(){this.game.world.setBounds(0,0,this.layer.widthInPixels,this.layer.heightInPixels)},b.TilemapLayer.prototype._fixX=function(a){return 0>a&&(a=0),1===this.scrollFactorX?a:this._x+(a-this._x/this.scrollFactorX)},b.TilemapLayer.prototype._unfixX=function(a){return 1===this.scrollFactorX?a:this._x/this.scrollFactorX+(a-this._x)},b.TilemapLayer.prototype._fixY=function(a){return 0>a&&(a=0),1===this.scrollFactorY?a:this._y+(a-this._y/this.scrollFactorY)},b.TilemapLayer.prototype._unfixY=function(a){return 1===this.scrollFactorY?a:this._y/this.scrollFactorY+(a-this._y)},b.TilemapLayer.prototype.getTileX=function(a){return this.game.math.snapToFloor(this._fixX(a),this.map.tileWidth)/this.map.tileWidth},b.TilemapLayer.prototype.getTileY=function(a){return this.game.math.snapToFloor(this._fixY(a),this.map.tileHeight)/this.map.tileHeight},b.TilemapLayer.prototype.getTileXY=function(a,b,c){return c.x=this.getTileX(a),c.y=this.getTileY(b),c},b.TilemapLayer.prototype.getTiles=function(a,b,c,d,e){"undefined"==typeof e&&(e=!1),a=this._fixX(a),b=this._fixY(b),c>this.layer.widthInPixels&&(c=this.layer.widthInPixels),d>this.layer.heightInPixels&&(d=this.layer.heightInPixels),this._tx=this.game.math.snapToFloor(a,this._cw)/this._cw,this._ty=this.game.math.snapToFloor(b,this._ch)/this._ch,this._tw=(this.game.math.snapToCeil(c,this._cw)+this._cw)/this._cw,this._th=(this.game.math.snapToCeil(d,this._ch)+this._ch)/this._ch,this._results.length=0;for(var f=this._ty;fthis.layer.width&&(this._maxX=this.layer.width),this._maxY>this.layer.height&&(this._maxY=this.layer.height)),this.dirty=!0},b.TilemapLayer.prototype.render=function(){if(this.layer.dirty&&(this.dirty=!0),this.dirty&&this.visible){this._prevX=this._dx,this._prevY=this._dy,this._dx=-(this._x-this._startX*this.map.tileWidth),this._dy=-(this._y-this._startY*this.map.tileHeight),this._tx=this._dx,this._ty=this._dy,this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.fillStyle=this.tileColor;var c,d;this.debug&&(this.context.globalAlpha=this.debugAlpha);for(var e=this._startY,f=this._startY+this._maxY;f>e;e++){this._column=this.layer.data[e];for(var g=this._startX,h=this._startX+this._maxX;h>g;g++)this._column[g]&&(c=this._column[g],this.map.tiles[c.index]&&(d=this.map.tilesets[this.map.tiles[c.index][2]],d.image?(this.debug===!1&&c.alpha!==this.context.globalAlpha&&(this.context.globalAlpha=c.alpha),d.tileWidth!==this.map.tileWidth||d.tileHeight!==this.map.tileHeight?this.context.drawImage(this.map.tilesets[this.map.tiles[c.index][2]].image,this.map.tiles[c.index][0],this.map.tiles[c.index][1],d.tileWidth,d.tileHeight,Math.floor(this._tx),Math.floor(this._ty)-(d.tileHeight-this.map.tileHeight),d.tileWidth,d.tileHeight):this.context.drawImage(this.map.tilesets[this.map.tiles[c.index][2]].image,this.map.tiles[c.index][0],this.map.tiles[c.index][1],this.map.tileWidth,this.map.tileHeight,Math.floor(this._tx),Math.floor(this._ty),this.map.tileWidth,this.map.tileHeight),c.debug&&(this.context.fillStyle="rgba(0, 255, 0, 0.4)",this.context.fillRect(Math.floor(this._tx),Math.floor(this._ty),this.map.tileWidth,this.map.tileHeight))):this.context.fillRect(Math.floor(this._tx),Math.floor(this._ty),this.map.tileWidth,this.map.tileHeight))),this._tx+=this.map.tileWidth;this._tx=this._dx,this._ty+=this.map.tileHeight}return this.debug&&(this.context.globalAlpha=1,this.renderDebug()),this.game.renderType===b.WEBGL&&a.texturesToUpdate.push(this.baseTexture),this.dirty=!1,this.layer.dirty=!1,!0}},b.TilemapLayer.prototype.renderDebug=function(){this._tx=this._dx,this._ty=this._dy,this.context.strokeStyle=this.debugColor,this.context.fillStyle=this.debugFillColor;for(var a=this._startY,b=this._startY+this._maxY;b>a;a++){this._column=this.layer.data[a];for(var c=this._startX,d=this._startX+this._maxX;d>c;c++){var e=this._column[c];e&&(e.faceTop||e.faceBottom||e.faceLeft||e.faceRight)&&(this._tx=Math.floor(this._tx),this.debugFill&&this.context.fillRect(this._tx,this._ty,this._cw,this._ch),this.context.beginPath(),e.faceTop&&(this.context.moveTo(this._tx,this._ty),this.context.lineTo(this._tx+this._cw,this._ty)),e.faceBottom&&(this.context.moveTo(this._tx,this._ty+this._ch),this.context.lineTo(this._tx+this._cw,this._ty+this._ch)),e.faceLeft&&(this.context.moveTo(this._tx,this._ty),this.context.lineTo(this._tx,this._ty+this._ch)),e.faceRight&&(this.context.moveTo(this._tx+this._cw,this._ty),this.context.lineTo(this._tx+this._cw,this._ty+this._ch)),this.context.stroke()),e&&(e.collisionCallback||e.layer.callbacks[e.index])&&(this.context.fillStyle=this.debugCallbackColor,this.context.fillRect(this._tx,this._ty,this._cw,this._ch),this.context.fillStyle=this.debugFillColor),this._tx+=this.map.tileWidth}this._tx=this._dx,this._ty+=this.map.tileHeight}},Object.defineProperty(b.TilemapLayer.prototype,"scrollX",{get:function(){return this._x},set:function(a){a!==this._x&&a>=0&&this.layer.widthInPixels>this.width&&(this._x=a,this._x>this.layer.widthInPixels-this.width&&(this._x=this.layer.widthInPixels-this.width),this._startX=this.game.math.floor(this._x/this.map.tileWidth),this._startX<0&&(this._startX=0),this._startX+this._maxX>this.layer.width&&(this._startX=this.layer.width-this._maxX),this.dirty=!0)}}),Object.defineProperty(b.TilemapLayer.prototype,"scrollY",{get:function(){return this._y},set:function(a){a!==this._y&&a>=0&&this.layer.heightInPixels>this.height&&(this._y=a,this._y>this.layer.heightInPixels-this.height&&(this._y=this.layer.heightInPixels-this.height),this._startY=this.game.math.floor(this._y/this.map.tileHeight),this._startY<0&&(this._startY=0),this._startY+this._maxY>this.layer.height&&(this._startY=this.layer.height-this._maxY),this.dirty=!0)}}),Object.defineProperty(b.TilemapLayer.prototype,"collisionWidth",{get:function(){return this._cw},set:function(a){this._cw=a,this.dirty=!0}}),Object.defineProperty(b.TilemapLayer.prototype,"collisionHeight",{get:function(){return this._ch},set:function(a){this._ch=a,this.dirty=!0}}),b.TilemapParser={tileset:function(a,c,d,e,f,g,h,i,j){var k=a.cache.getTilesetImage(c);if(null===k)return console.warn("Phaser.TilemapParser.tileSet: Invalid image key given"),null;var l=k.width,m=k.height;return-1===h&&(h=Math.round(l/d)),-1===i&&(i=Math.round(m/e)),-1===j&&(j=h*i),0===l||0===m||d>l||e>m||0===j?(console.warn("Phaser.TilemapParser.tileSet: width/height zero or width/height < given tileWidth/tileHeight"),null):new b.Tileset(k,c,d,e,f,g,h,i,j)},parse:function(a,c){var d=a.cache.getTilemapData(c);return d?d.format===b.Tilemap.CSV?this.parseCSV(d.data):d.format===b.Tilemap.TILED_JSON?this.parseTiledJSON(d.data):void 0:this.getEmptyData()},parseCSV:function(a){a=a.trim();for(var b=[],c=a.split("\n"),d=c.length,e=0,f=0;fj;j++)a.layers[e].data[j]>0?h.push(new b.Tile(f,a.layers[e].data[j],g,i.length,a.tilewidth,a.tileheight)):h.push(null),g++,g===a.layers[e].width&&(i.push(h),g=0,h=[]);f.data=i,d.push(f)}c.layers=d;for(var l=[],e=0;ep;p++)if(a.layers[e].objects[p].gid){var q={gid:a.layers[e].objects[p].gid,name:a.layers[e].objects[p].name,x:a.layers[e].objects[p].x,y:a.layers[e].objects[p].y,visible:a.layers[e].objects[p].visible,properties:a.layers[e].objects[p].properties};n[a.layers[e].name].push(q)}else if(a.layers[e].objects[p].polyline){var q={name:a.layers[e].objects[p].name,x:a.layers[e].objects[p].x,y:a.layers[e].objects[p].y,width:a.layers[e].objects[p].width,height:a.layers[e].objects[p].height,visible:a.layers[e].objects[p].visible,properties:a.layers[e].objects[p].properties};q.polyline=[];for(var r=0;rBitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -613,6 +621,12 @@ Phaser.Animation.prototype = { this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]); this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + if (this._parent.__tilePattern) + { + this._parent.__tilePattern = false; + this._parent.tilingTexture = false; + } + if (this._parent.events) { this._parent.events.onAnimationStart.dispatch(this._parent, this); @@ -710,6 +724,12 @@ Phaser.Animation.prototype = { if (this.currentFrame) { this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + + if (this._parent.__tilePattern) + { + this._parent.__tilePattern = false; + this._parent.tilingTexture = false; + } } this._parent.events.onAnimationLoop.dispatch(this._parent, this); @@ -726,6 +746,12 @@ Phaser.Animation.prototype = { if (this.currentFrame) { this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + + if (this._parent.__tilePattern) + { + this._parent.__tilePattern = false; + this._parent.tilingTexture = false; + } } } @@ -943,7 +969,7 @@ Phaser.Animation.generateFrameNames = function (prefix, start, stop, suffix, zer Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/AnimationManager.js.html b/docs/AnimationManager.js.html index a8154b53..04c30f52 100644 --- a/docs/AnimationManager.js.html +++ b/docs/AnimationManager.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -586,6 +594,12 @@ Phaser.AnimationManager.prototype = { this.currentFrame = this.currentAnim.currentFrame; this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + if (this.sprite.__tilePattern) + { + this.__tilePattern = false; + this.tilingTexture = false; + } + return this._anims[name]; }, @@ -704,7 +718,6 @@ Phaser.AnimationManager.prototype = { if (this.currentAnim && this.currentAnim.update() === true) { this.currentFrame = this.currentAnim.currentFrame; - this.sprite.currentFrame = this.currentFrame; return true; } @@ -721,7 +734,7 @@ Phaser.AnimationManager.prototype = { */ getAnimation: function (name) { - if (typeof name == 'string') + if (typeof name === 'string') { if (this._anims[name]) { @@ -740,9 +753,14 @@ Phaser.AnimationManager.prototype = { */ refreshFrame: function () { - this.sprite.currentFrame = this.currentFrame; this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + if (this.sprite.__tilePattern) + { + this.__tilePattern = false; + this.tilingTexture = false; + } + }, /** @@ -839,8 +857,13 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'frame', { { this.currentFrame = this._frameData.getFrame(value); this._frameIndex = value; - this.sprite.currentFrame = this.currentFrame; this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + + if (this.sprite.__tilePattern) + { + this.__tilePattern = false; + this.tilingTexture = false; + } } } @@ -868,8 +891,13 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'frameName', { { this.currentFrame = this._frameData.getFrameByName(value); this._frameIndex = this.currentFrame.index; - this.sprite.currentFrame = this.currentFrame; this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]); + + if (this.sprite.__tilePattern) + { + this.__tilePattern = false; + this.tilingTexture = false; + } } else { @@ -899,7 +927,7 @@ Object.defineProperty(Phaser.AnimationManager.prototype, 'frameName', { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/AnimationParser.js.html b/docs/AnimationParser.js.html index a840213d..cbb2ef33 100644 --- a/docs/AnimationParser.js.html +++ b/docs/AnimationParser.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -604,16 +612,9 @@ Phaser.AnimationParser = { frames[i].spriteSourceSize.h ); - PIXI.TextureCache[uuid].trimmed = true; - - PIXI.TextureCache[uuid].trim = { - x: frames[i].spriteSourceSize.x, - y: frames[i].spriteSourceSize.y, - realWidth: frames[i].sourceSize.w, - realHeight: frames[i].sourceSize.h - } - + PIXI.TextureCache[uuid].trim = new Phaser.Rectangle(frames[i].spriteSourceSize.x, frames[i].spriteSourceSize.y, frames[i].sourceSize.w, frames[i].sourceSize.h); } + } return data; @@ -680,15 +681,7 @@ Phaser.AnimationParser = { frames[key].spriteSourceSize.h ); - PIXI.TextureCache[uuid].trimmed = true; - - PIXI.TextureCache[uuid].trim = { - x: frames[i].spriteSourceSize.x, - y: frames[i].spriteSourceSize.y, - realWidth: frames[i].sourceSize.w, - realHeight: frames[i].sourceSize.h - } - + PIXI.TextureCache[uuid].trim = new Phaser.Rectangle(frames[key].spriteSourceSize.x, frames[key].spriteSourceSize.y, frames[key].sourceSize.w, frames[key].sourceSize.h); } i++; @@ -770,16 +763,7 @@ Phaser.AnimationParser = { { newFrame.setTrim(true, width, height, frameX, frameY, frameWidth, frameHeight); - PIXI.TextureCache[uuid].realSize = { x: frameX, y: frameY, w: frameWidth, h: frameHeight }; - - PIXI.TextureCache[uuid].trimmed = true; - - PIXI.TextureCache[uuid].trim = { - x: frameX, - y: frameY, - realWidth: width, - realHeight: height - } + PIXI.TextureCache[uuid].trim = new Phaser.Rectangle(frameX, frameY, width, height); } } @@ -809,7 +793,7 @@ Phaser.AnimationParser = { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/ArcadePhysics.js.html b/docs/ArcadePhysics.js.html index 6d71589f..f3710930 100644 --- a/docs/ArcadePhysics.js.html +++ b/docs/ArcadePhysics.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1887,7 +1895,7 @@ Phaser.Physics.Arcade.prototype.constructor = Phaser.Physics.Arcade; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/BitmapData.js.html b/docs/BitmapData.js.html index ec9200d0..922482d4 100644 --- a/docs/BitmapData.js.html +++ b/docs/BitmapData.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -460,11 +468,8 @@ * * @class Phaser.BitmapData * -* @classdesc Note: This object is still experimental and likely to change. -* -* A BitmapData object can be thought of as a blank canvas onto which you can perform graphics operations as you would on a normal canvas, -* such as drawing lines, circles, arcs, fills and copying and setting blocks of pixel data. A single BitmapData can be used as the texture -* for multiple Sprites. So if you need to dynamically create a Sprite texture then they are a good choice. It supports the EaselJS Tiny API. +* @classdesc A BitmapData object contains a Canvas element to which you can draw anything you like via normal Canvas context operations. +* A single BitmapData can be used as the texture one or many Images/Sprites. So if you need to dynamically create a Sprite texture then they are a good choice. * * @constructor * @param {Phaser.Game} game - A reference to the currently running game. @@ -509,6 +514,11 @@ Phaser.BitmapData = function (game, key, width, height) { */ this.context = this.canvas.getContext('2d'); + /** + * @property {CanvasRenderingContext2D} ctx - A reference to BitmapData.context. + */ + this.ctx = this.context; + /** * @property {array} imageData - The canvas image data. */ @@ -557,30 +567,27 @@ Phaser.BitmapData = function (game, key, width, height) { Phaser.BitmapData.prototype = { /** - * Updates the given Sprite so that it uses this BitmapData as its texture. + * Updates the given objects so that they use this BitmapData as their texture. + * * @method Phaser.BitmapData#add - * @param {Phaser.Sprite} sprite - The sprite to apply this texture to. + * @param {Phaser.Sprite|Phaser.Sprite[]|Phaser.Image|Phaser.Image[]} object - Either a single Sprite/Image or an Array of Sprites/Images. */ - add: function (sprite) { + add: function (object) { - sprite.loadTexture(this); - - }, - - /** - * Given an array of Sprites it will update each of them so that their Textures reference this BitmapData. - * @method Phaser.BitmapData#addTo - * @param {Phaser.Sprite[]} sprites - An array of Sprites to apply this texture to. - */ - addTo: function (sprites) { - - for (var i = 0; i < sprites.length; i++) + if (Array.isArray(object)) { - if (sprites[i].texture) + for (var i = 0; i < object.length; i++) { - sprites[i].loadTexture(this); + if (object[i]['loadTexture']) + { + object[i].loadTexture(this); + } } } + else + { + object.loadTexture(this); + } }, @@ -596,6 +603,31 @@ Phaser.BitmapData.prototype = { }, + /** + * Resizes the BitmapData. + * @method Phaser.BitmapData#resize + */ + resize: function (width, height) { + + if (width !== this.width || height !== this.height) + { + console.log('bmd resize', width, height); + this.width = width; + this.height = height; + this.canvas.width = width; + this.canvas.height = height; + this.textureFrame.width = width; + this.textureFrame.height = height; + this.imageData = this.context.getImageData(0, 0, width, height); + } + + this._dirty = true; + + }, + + /** + * @method Phaser.BitmapData#refreshBuffer + */ refreshBuffer: function () { this.imageData = this.context.getImageData(0, 0, this.width, this.height); @@ -698,697 +730,12 @@ Phaser.BitmapData.prototype = { }, - /** - * Adds an arc to the path which is centered at (x, y) position with radius r starting at startAngle and ending at endAngle - * going in the given direction by anticlockwise (defaulting to clockwise). - * @method Phaser.BitmapData#arc - * @param {number} x - The x axis of the coordinate for the arc's center - * @param {number} y - The y axis of the coordinate for the arc's center - * @param {number} radius - The arc's radius - * @param {number} startAngle - The starting point, measured from the x axis, from which it will be drawn, expressed in radians. - * @param {number} endAngle - The end arc's angle to which it will be drawn, expressed in radians. - * @param {boolean} [anticlockwise=true] - true draws the arc anticlockwise, otherwise in a clockwise direction. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - arc: function (x, y, radius, startAngle, endAngle, anticlockwise) { + copyPixels: function (source, area, destX, destY) { - if (typeof anticlockwise === 'undefined') { anticlockwise = false; } - - this._dirty = true; - this.context.arc(x, y, radius, startAngle, endAngle, anticlockwise); - return this; + this.context.drawImage(source, area.x, area.y, area.width, area.height, destX, destY, area.width, area.height); }, - /** - * Adds an arc with the given control points and radius, connected to the previous point by a straight line. - * @method Phaser.BitmapData#arcTo - * @param {number} x1 - * @param {number} y1 - * @param {number} x2 - * @param {number} y2 - * @param {number} radius - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - arcTo: function (x1, y1, x2, y2, radius) { - - this._dirty = true; - this.context.arcTo(x1, y1, x2, y2, radius); - return this; - - }, - - /** - * Begins a fill with the specified color. This ends the current sub-path. - * @method Phaser.BitmapData#beginFill - * @param {string} color - A CSS compatible color value (ex. "red", "#FF0000", or "rgba(255,0,0,0.5)"). Setting to null will result in no fill. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - beginFill: function (color) { - - this.fillStyle(color); - - return this; - - }, - - /** - * Begins a linear gradient fill defined by the line (x0, y0) to (x1, y1). This ends the current sub-path. For - * example, the following code defines a black to white vertical gradient ranging from 20px to 120px, and draws a square to display it: - * - * ```myGraphics.beginLinearGradientFill(["#000","#FFF"], [0, 1], 0, 20, 0, 120).rect(20, 20, 120, 120);``` - * - * @method Phaser.BitmapData#beginLinearGradientFill - * @param {Array} colors - An array of CSS compatible color values. For example, ["#F00","#00F"] would define a gradient drawing from red to blue. - * @param {Array} ratios - An array of gradient positions which correspond to the colors. For example, [0.1, 0.9] would draw the first color to 10% then interpolating to the second color at 90%. - * @param {number} x0 - The position of the first point defining the line that defines the gradient direction and size. - * @param {number} y0 - The position of the first point defining the line that defines the gradient direction and size. - * @param {number} x1 - The position of the second point defining the line that defines the gradient direction and size. - * @param {number} y1 - The position of the second point defining the line that defines the gradient direction and size. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - beginLinearGradientFill: function (colors, ratios, x0, y0, x1, y1) { - - var gradient = this.createLinearGradient(x0, y0, x1, y1); - - for (var i = 0, len = colors.length; i < len; i++) - { - gradient.addColorStop(ratios[i], colors[i]); - } - - this.fillStyle(gradient); - - return this; - - }, - - /** - * Begins a linear gradient stroke defined by the line (x0, y0) to (x1, y1). This ends the current sub-path. For - * example, the following code defines a black to white vertical gradient ranging from 20px to 120px, and draws a - * square to display it: - * - * ```myGraphics.setStrokeStyle(10).beginLinearGradientStroke(["#000","#FFF"], [0, 1], 0, 20, 0, 120).drawRect(20, 20, 120, 120);``` - * - * @method Phaser.BitmapData#beginLinearGradientStroke - * @param {Array} colors - An array of CSS compatible color values. For example, ["#F00","#00F"] would define a gradient drawing from red to blue. - * @param {Array} ratios - An array of gradient positions which correspond to the colors. For example, [0.1, 0.9] would draw the first color to 10% then interpolating to the second color at 90%. - * @param {number} x0 - The position of the first point defining the line that defines the gradient direction and size. - * @param {number} y0 - The position of the first point defining the line that defines the gradient direction and size. - * @param {number} x1 - The position of the second point defining the line that defines the gradient direction and size. - * @param {number} y1 - The position of the second point defining the line that defines the gradient direction and size. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - beginLinearGradientStroke: function (colors, ratios, x0, y0, x1, y1) { - - var gradient = this.createLinearGradient(x0, y0, x1, y1); - - for (var i = 0, len = colors.length; i < len; i++) - { - gradient.addColorStop(ratios[i], colors[i]); - } - - this.strokeStyle(gradient); - - return this; - - }, - - /** - * Begins a radial gradient stroke. This ends the current sub-path. For example, the following code defines a red to - * blue radial gradient centered at (100, 100), with a radius of 50, and draws a rectangle to display it: - * - * myGraphics.setStrokeStyle(10) - * .beginRadialGradientStroke(["#F00","#00F"], [0, 1], 100, 100, 0, 100, 100, 50) - * .drawRect(50, 90, 150, 110); - * - * @method Phaser.BitmapData#beginRadialGradientStroke - * @param {Array} colors - An array of CSS compatible color values. For example, ["#F00","#00F"] would define a gradient drawing from red to blue. - * @param {Array} ratios - An array of gradient positions which correspond to the colors. For example, [0.1, 0.9] would draw the first color to 10% then interpolating to the second color at 90%. - * @param {number} x0 - Center position of the inner circle that defines the gradient. - * @param {number} y0 - Center position of the inner circle that defines the gradient. - * @param {number} r0 - Radius of the inner circle that defines the gradient. - * @param {number} x1 - Center position of the outer circle that defines the gradient. - * @param {number} y1 - Center position of the outer circle that defines the gradient. - * @param {number} r1 - Radius of the outer circle that defines the gradient. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - beginRadialGradientStroke: function (colors, ratios, x0, y0, r0, x1, y1, r1) { - - var gradient = this.createRadialGradient(x0, y0, r0, x1, y1, r1); - - for (var i = 0, len = colors.length; i < len; i++) - { - gradient.addColorStop(ratios[i], colors[i]); - } - - this.strokeStyle(gradient); - - return this; - - }, - - /** - * Starts a new path by resetting the list of sub-paths. Call this method when you want to create a new path. - * @method Phaser.BitmapData#beginPath - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - beginPath: function () { - - this.context.beginPath(); - return this; - - }, - - /** - * Begins a stroke with the specified color. This ends the current sub-path. - * @method Phaser.BitmapData#beginStroke - * @param {String} color A CSS compatible color value (ex. "#FF0000", "red", or "rgba(255,0,0,0.5)"). Setting to null will result in no stroke. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - beginStroke: function (color) { - - this.strokeStyle(color); - return this; - - }, - - /** - * Adds a bezier curve from the current context point to (x, y) using the control points (cp1x, cp1y) and (cp2x, cp2y). - * @method Phaser.BitmapData#bezierCurveTo - * @param {number} cp1x - The x axis of control point 1. - * @param {number} cp1y - The y axis of control point 1. - * @param {number} cp2x - The x axis of control point 2. - * @param {number} cp2y - The y axis of control point 2. - * @param {number} x - The x axis of the ending point. - * @param {number} y - The y axis of the ending point. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - bezierCurveTo: function (cp1x, cp1y, cp2x, cp2y, x, y) { - - this._dirty = true; - this.context.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y); - return this; - - }, - - /** - * Draws a circle with the specified radius at (x, y). - * @method Phaser.BitmapData#circle - * @param {number} x - x coordinate center point of circle. - * @param {number} y - y coordinate center point of circle. - * @param {number} radius - Radius of circle in radians. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - circle: function (x, y, radius) { - - this.arc(x, y, radius, 0, Math.PI*2); - return this; - - }, - - /** - * Sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black. - * @method Phaser.BitmapData#clearRect - * @param {number} x - The x axis of the coordinate for the rectangle starting point. - * @param {number} y - The y axis of the coordinate for the rectangle starting point. - * @param {number} width - The rectangles width. - * @param {number} height - The rectangles height. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - clearRect: function (x, y, width, height) { - - this._dirty = true; - this.context.clearRect(x, y, width, height); - return this; - - }, - - /** - * Creates a clipping path from the current sub-paths. Everything drawn after clip() is called appears inside the clipping path only. - * @method Phaser.BitmapData#clip - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - clip: function () { - - this._dirty = true; - this.context.clip(); - return this; - - }, - - /** - * Tries to draw a straight line from the current point to the start. If the shape has already been closed or has only one point, this function does nothing. - * @method Phaser.BitmapData#closePath - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - closePath: function () { - - this._dirty = true; - this.context.closePath(); - return this; - - }, - - /** - * Creates a linear gradient with defined by an imaginary line which implies the direction of the gradient. - * Once the gradient is created colors can be inserted using the addColorStop method. - * @method Phaser.BitmapData#createLinearGradient - * @param {number} x - The x axis of the coordinate for the gradients starting point. - * @param {number} y - The y axis of the coordinate for the gradients starting point. - * @param {number} width - The width of the gradient. - * @param {number} height - The height of the gradient. - * @return {CanvasGradient} The Linear Gradient. - */ - createLinearGradient: function (x, y, width, height) { - - return this.context.createLinearGradient(x, y, width, height); - - }, - - // createPattern - - /** - * Creates a radial gradient. - * @method Phaser.BitmapData#createRadialGradient - * @param {number} x0 - * @param {number} y0 - * @param {number} r0 - * @param {number} x1 - * @param {number} y1 - * @param {number} r1 - * @return {CanvasGradient} The Radial Gradient. - */ - createRadialGradient: function (x0, y0, r0, x1, y1, r1) { - - return this.context.createRadialGradient(x0, y0, r0, x1, y1, r1); - - }, - - // drawImage - // drawSystemFocusRing (?) - - /** - * Draws an ellipse (oval) with a specified width (w) and height (h). - * @method Phaser.BitmapData#ellipse - * @param {number} x - x coordinate center point of ellipse. - * @param {number} y - y coordinate center point of ellipse. - * @param {number} w - height (horizontal diameter) of ellipse. The horizontal radius will be half of this number. - * @param {number} h - width (vertical diameter) of ellipse. The vertical radius will be half of this number. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - ellipse: function (x, y, w, h) { - - var k = 0.5522848; - var ox = (w / 2) * k; - var oy = (h / 2) * k; - var xe = x + w; - var ye = y + h; - var xm = x + w / 2; - var ym = y + h / 2; - - this.moveTo(x, ym); - this.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y); - this.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym); - this.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye); - this.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym); - - return this; - - }, - - /** - * Fills the subpaths with the current fill style. - * @method Phaser.BitmapData#fill - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - fill: function () { - - this._dirty = true; - this.context.fill(); - return this; - - }, - - /** - * Draws a filled rectangle at (x, y) position whose size is determined by width and height. - * @method Phaser.BitmapData#fillRect - * @param {number} x - The x axis of the coordinate for the rectangle starting point. - * @param {number} y - The y axis of the coordinate for the rectangle starting point. - * @param {number} width - The rectangles width. - * @param {number} height - The rectangles height. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - fillRect: function (x, y, width, height) { - - this._dirty = true; - this.context.fillRect(x, y, width, height); - return this; - - }, - - /** - * Sets the fill style. - * @method Phaser.BitmapData#fillStyle - * @param {string} color - The fill color value in CSS format: #RRGGBB or rgba(r,g,b,a) - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - fillStyle: function (color) { - - this.context.fillStyle = color; - return this; - - }, - - // fillText - - /** - * Sets the font. - * @method Phaser.BitmapData#font - * @param {DOMString} font - The font to be used for any text rendering. Default value 10px sans-serif. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - font: function (font) { - - this.context.font = font; - return this; - - }, - - /** - * Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque). - * @method Phaser.BitmapData#globalAlpha - * @param {number} alpha - Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque). - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - globalAlpha: function (alpha) { - - this.context.globalAlpha = alpha; - return this; - - }, - - /** - * With globalAlpha applied this sets how shapes and images are drawn onto the existing bitmap. Possible values: source-atop, source-in, source-out, - * source-over (default), destination-atop, destination-in, destination-out, destination-over, lighter, darker, copy and xor. - * @method Phaser.BitmapData#globalCompositeOperation - * @param {DOMString} operation - The composite operation to apply. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - globalCompositeOperation: function (operation) { - - this.context.globalCompositeOperation = operation; - return this; - - }, - - /** - * Type of endings on the end of lines. Possible values: butt (default), round, square. - * @method Phaser.BitmapData#lineCap - * @param {DOMString} style - Possible values: butt (default), round, square - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - lineCap: function (style) { - - this.context.lineCap = style; - return this; - - }, - - /** - * Specifies where to start a dasharray on a line. - * @method Phaser.BitmapData#lineDashOffset - * @param {number} offset - Specifies where to start a dasharray on a line. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - lineDashOffset: function (offset) { - - this.context.lineDashOffset = offset; - return this; - - }, - - /** - * Defines the type of corners where two lines meet. Possible values: round, bevel, miter (default) - * @method Phaser.BitmapData#lineJoin - * @param {DOMString} join - Possible values: round, bevel, miter (default) - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - lineJoin: function (join) { - - this.context.lineJoin = join; - return this; - - }, - - /** - * Width of lines. Default 1.0 - * @method Phaser.BitmapData#lineWidth - * @param {number} width - Width of lines. Default 1.0 - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - lineWidth: function (width) { - - this.context.lineWidth = width; - return this; - - }, - - /** - * Default 10. - * @method Phaser.BitmapData#miterLimit - * @param {number} limit - Default 10. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - miterLimit: function (limit) { - - this.context.miterLimit = limit; - return this; - - }, - - // getImageData - // getLineDash - // isPointInPath - // isPointInStroke - - /** - * Connects the last point in the subpath to the x, y coordinates with a straight line. - * @method Phaser.BitmapData#lineTo - * @param {number} x - The x axis of the coordinate for the end of the line. - * @param {number} y - The y axis of the coordinate for the end of the line. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - lineTo: function (x, y) { - - this._dirty = true; - this.context.lineTo(x, y); - return this; - - }, - - // measureText - - /** - * Moves the starting point of a new subpath to the (x, y) coordinates. - * @method Phaser.BitmapData#moveTo - * @param {number} x - The x axis of the point. - * @param {number} y - The y axis of the point. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - moveTo: function (x, y) { - - this.context.moveTo(x, y); - return this; - - }, - - // putImageData - - /** - * Draws a quadratic curve from the current drawing point to (x, y) using the control point (cpx, cpy). - * @method Phaser.BitmapData#quadraticCurveTo - * @param {Number} cpx - The x axis of the control point. - * @param {Number} cpy - The y axis of the control point. - * @param {Number} x - The x axis of the ending point. - * @param {Number} y - The y axis of the ending point. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - quadraticCurveTo: function(cpx, cpy, x, y) { - - this._dirty = true; - this.context.quadraticCurveTo(cpx, cpy, x, y); - return this; - - }, - - /** - * Draws a rectangle at (x, y) position whose size is determined by width and height. - * @method Phaser.BitmapData#rect - * @param {number} x - The x axis of the coordinate for the rectangle starting point. - * @param {number} y - The y axis of the coordinate for the rectangle starting point. - * @param {number} width - The rectangles width. - * @param {number} height - The rectangles height. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - rect: function (x, y, width, height) { - - this._dirty = true; - this.context.rect(x, y, width, height); - return this; - - }, - - /** - * Restores the drawing style state to the last element on the 'state stack' saved by save(). - * @method Phaser.BitmapData#restore - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - restore: function () { - - this._dirty = true; - this.context.restore(); - return this; - - }, - - /** - * Rotates the drawing context values by r radians. - * @method Phaser.BitmapData#rotate - * @param {number} angle - The angle of rotation given in radians. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - rotate: function (angle) { - - this._dirty = true; - this.context.rotate(angle); - return this; - - }, - - /** - * Sets the stroke style for the current sub-path. Like all drawing methods, this can be chained, so you can define - * the stroke style and color in a single line of code like so: - * - * ```myGraphics.setStrokeStyle(8,"round").beginStroke("#F00");``` - * - * @method Phaser.BitmapData#setStrokeStyle - * @param {number} thickness - The width of the stroke. - * @param {string|number} [caps=0] - Indicates the type of caps to use at the end of lines. One of butt, round, or square. Defaults to "butt". Also accepts the values 0 (butt), 1 (round), and 2 (square) for use with he tiny API. - * @param {string|number} [joints=0] Specifies the type of joints that should be used where two lines meet. One of bevel, round, or miter. Defaults to "miter". Also accepts the values 0 (miter), 1 (round), and 2 (bevel) for use with the tiny API. - * @param {number} [miterLimit=10] - If joints is set to "miter", then you can specify a miter limit ratio which controls at what point a mitered joint will be clipped. - * @param {boolean} [ignoreScale=false] - If true, the stroke will be drawn at the specified thickness regardless of active transformations. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - setStrokeStyle: function (thickness, caps, joints, miterLimit, ignoreScale) { - - if (typeof thickness === 'undefined') { thickness = 1; } - if (typeof caps === 'undefined') { caps = 'butt'; } - if (typeof joints === 'undefined') { joints = 'miter'; } - if (typeof miterLimit === 'undefined') { miterLimit = 10; } - - // TODO - ignoreScale = false; - - this.lineWidth(thickness); - this.lineCap(caps); - this.lineJoin(joints); - this.miterLimit(miterLimit); - - return this; - - }, - - /** - * Saves the current drawing style state using a stack so you can revert any change you make to it using restore(). - * @method Phaser.BitmapData#save - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - save: function () { - - this._dirty = true; - this.context.save(); - return this; - - }, - - /** - * Scales the current drawing context. - * @method Phaser.BitmapData#scale - * @param {number} x - * @param {number} y - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - scale: function (x, y) { - - this._dirty = true; - this.context.scale(x, y); - return this; - - }, - - /** - * - * @method Phaser.BitmapData#scrollPathIntoView - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - scrollPathIntoView: function () { - - this._dirty = true; - this.context.scrollPathIntoView(); - return this; - - }, - - // setLineDash - // setTransform - - /** - * Strokes the subpaths with the current stroke style. - * @method Phaser.BitmapData#stroke - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - stroke: function () { - - this._dirty = true; - this.context.stroke(); - return this; - - }, - - /** - * Paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style. - * @method Phaser.BitmapData#strokeRect - * @param {number} x - The x axis for the starting point of the rectangle. - * @param {number} y - The y axis for the starting point of the rectangle. - * @param {number} width - The rectangles width. - * @param {number} height - The rectangles height. - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - strokeRect: function (x, y, width, height) { - - this._dirty = true; - this.context.strokeRect(x, y, width, height); - return this; - - }, - - /** - * Color or style to use for the lines around shapes. Default #000 (black). - * @method Phaser.BitmapData#strokeStyle - * @param {string} style - Color or style to use for the lines around shapes. Default #000 (black). - * @return {Phaser.BitmapData} The BitmapData instance this method was called on. - */ - strokeStyle: function (style) { - - this.context.strokeStyle = style; - return this; - - }, - - // strokeText - // transform - // translate - /** * If the game is running in WebGL this will push the texture up to the GPU if it's dirty. * This is called automatically if the BitmapData is being used by a Sprite, otherwise you need to remember to call it in your render function. @@ -1412,164 +759,6 @@ Phaser.BitmapData.prototype = { }; Phaser.BitmapData.prototype.constructor = Phaser.BitmapData; - -// EaselJS Tiny API emulation - -/** -* Shortcut to moveTo. -* @method Phaser.BitmapData.prototype.mt -*/ -Phaser.BitmapData.prototype.mt = Phaser.BitmapData.prototype.moveTo; - -/** -* Shortcut to lineTo. -* @method Phaser.BitmapData.prototype.mt -*/ -Phaser.BitmapData.prototype.lt = Phaser.BitmapData.prototype.lineTo; - -/** -* Shortcut to arcTo. -* @method Phaser.BitmapData.prototype.at -*/ -Phaser.BitmapData.prototype.at = Phaser.BitmapData.prototype.arcTo; - -/** -* Shortcut to bezierCurveTo. -* @method Phaser.BitmapData.prototype.bt -*/ -Phaser.BitmapData.prototype.bt = Phaser.BitmapData.prototype.bezierCurveTo; - -/** -* Shortcut to quadraticCurveTo. -* @method Phaser.BitmapData.prototype.qt -*/ -Phaser.BitmapData.prototype.qt = Phaser.BitmapData.prototype.quadraticCurveTo; - -/** -* Shortcut to arc. -* @method Phaser.BitmapData.prototype.a -*/ -Phaser.BitmapData.prototype.a = Phaser.BitmapData.prototype.arc; - -/** -* Shortcut to rect. -* @method Phaser.BitmapData.prototype.r -*/ -Phaser.BitmapData.prototype.r = Phaser.BitmapData.prototype.rect; - -/** -* Shortcut to closePath. -* @method Phaser.BitmapData.prototype.cp -*/ -Phaser.BitmapData.prototype.cp = Phaser.BitmapData.prototype.closePath; - -/** -* Shortcut to clear. -* @method Phaser.BitmapData.prototype.c -*/ -Phaser.BitmapData.prototype.c = Phaser.BitmapData.prototype.clear; - -/** -* Shortcut to beginFill. -* @method Phaser.BitmapData.prototype.f -*/ -Phaser.BitmapData.prototype.f = Phaser.BitmapData.prototype.beginFill; - -/** -* Shortcut to beginLinearGradientFill. -* @method Phaser.BitmapData.prototype.lf -*/ -Phaser.BitmapData.prototype.lf = Phaser.BitmapData.prototype.beginLinearGradientFill; - -/** -* Shortcut to beginRadialGradientFill. -* @method Phaser.BitmapData.prototype.rf -*/ -Phaser.BitmapData.prototype.rf = Phaser.BitmapData.prototype.beginRadialGradientFill; - -/** -* Shortcut to beginBitmapFill. -* @method Phaser.BitmapData.prototype.bf -*/ -//Phaser.BitmapData.prototype.bf = Phaser.BitmapData.prototype.beginBitmapFill; - -/** -* Shortcut to endFill. -* @method Phaser.BitmapData.prototype.ef -*/ -Phaser.BitmapData.prototype.ef = Phaser.BitmapData.prototype.endFill; - -/** -* Shortcut to setStrokeStyle. -* @method Phaser.BitmapData.prototype.ss -*/ -Phaser.BitmapData.prototype.ss = Phaser.BitmapData.prototype.setStrokeStyle; - -/** -* Shortcut to beginStroke. -* @method Phaser.BitmapData.prototype.s -*/ -Phaser.BitmapData.prototype.s = Phaser.BitmapData.prototype.beginStroke; - -/** -* Shortcut to beginLinearGradientStroke. -* @method Phaser.BitmapData.prototype.ls -*/ -Phaser.BitmapData.prototype.ls = Phaser.BitmapData.prototype.beginLinearGradientStroke; - -/** -* Shortcut to beginRadialGradientStroke. -* @method Phaser.BitmapData.prototype.rs -*/ -Phaser.BitmapData.prototype.rs = Phaser.BitmapData.prototype.beginRadialGradientStroke; - -/** -* Shortcut to beginBitmapStroke. -* @method Phaser.BitmapData.prototype.bs -*/ -// Phaser.BitmapData.prototype.bs = Phaser.BitmapData.prototype.beginBitmapStroke; - -/** -* Shortcut to endStroke. -* @method Phaser.BitmapData.prototype.es -*/ -// Phaser.BitmapData.prototype.es = Phaser.BitmapData.prototype.endStroke; - -/** -* Shortcut to rect. -* @method Phaser.BitmapData.prototype.dr -*/ -Phaser.BitmapData.prototype.dr = Phaser.BitmapData.prototype.rect; - -/** -* Shortcut to drawRoundRect. -* @method Phaser.BitmapData.prototype.rr -*/ -// Phaser.BitmapData.prototype.rr = Phaser.BitmapData.prototype.drawRoundRect; - -/** -* Shortcut to drawRoundRectComplex. -* @method Phaser.BitmapData.prototype.rc -*/ -// Phaser.BitmapData.prototype.rc = Phaser.BitmapData.prototype.drawRoundRectComplex; - -/** -* Shortcut to drawCircle. -* @method Phaser.BitmapData.prototype.dc -*/ -Phaser.BitmapData.prototype.dc = Phaser.BitmapData.prototype.circle; - -/** -* Shortcut to drawEllipse. -* @method Phaser.BitmapData.prototype.de -*/ -Phaser.BitmapData.prototype.de = Phaser.BitmapData.prototype.ellipse; - -/** -* Shortcut to drawPolyStar. -* @method Phaser.BitmapData.prototype.dp -*/ -// Phaser.BitmapData.prototype.dp = Phaser.BitmapData.prototype.drawPolyStar; @@ -1591,7 +780,7 @@ Phaser.BitmapData.prototype.de = Phaser.BitmapData.prototype.ellipse; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/BitmapFont.js.html b/docs/BitmapFont.js.html new file mode 100644 index 00000000..483670af --- /dev/null +++ b/docs/BitmapFont.js.html @@ -0,0 +1,1093 @@ + + + + + + Phaser Source: gameobjects/BitmapFont.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: gameobjects/BitmapFont.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.BitmapFont
    +* @extends Phaser.RenderTexture
    +* @constructor
    +* @param {Phaser.Game} game - Current game instance.
    +* @param {string} key - The font set graphic set as stored in the Game.Cache.
    +* @param {number} characterWidth - The width of each character in the font set.
    +* @param {number} characterHeight - The height of each character in the font set.
    +* @param {string} chars - The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements.
    +* @param {number} charsPerRow - The number of characters per row in the font set.
    +* @param {number} [xSpacing=0] - If the characters in the font set have horizontal spacing between them set the required amount here.
    +* @param {number} [ySpacing=0] - If the characters in the font set have vertical spacing between them set the required amount here.
    +* @param {number} [xOffset=0] - If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.
    +* @param {number} [yOffset=0] - If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.
    +*/
    +Phaser.BitmapFont = function (game, key, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset) {
    +
    +    /**
    +    * @property {number} characterWidth - The width of each character in the font set.
    +    */
    +    this.characterWidth = characterWidth;
    +
    +    /**
    +    * @property {number} characterHeight - The height of each character in the font set.
    +    */
    +    this.characterHeight = characterHeight;
    +
    +    /**
    +    * @property {number} characterSpacingX - If the characters in the font set have horizontal spacing between them set the required amount here.
    +    */
    +    this.characterSpacingX = xSpacing || 0;
    +
    +    /**
    +    * @property {number} characterSpacingY - If the characters in the font set have vertical spacing between them set the required amount here.
    +    */
    +    this.characterSpacingY = ySpacing || 0;
    +
    +    /**
    +    * @property {number} characterPerRow - The number of characters per row in the font set.
    +    */
    +    this.characterPerRow = charsPerRow;
    +
    +    /**
    +    * @property {number} offsetX - If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.
    +    */
    +    this.offsetX = xOffset || 0;
    +
    +    /**
    +    * @property {number} offsetY - If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.
    +    */
    +    this.offsetY = yOffset || 0;
    +
    +    /**
    +    * @property {string} align - Alignment of the text when multiLine = true or a fixedWidth is set. Set to BitmapFont.ALIGN_LEFT (default), BitmapFont.ALIGN_RIGHT or BitmapFont.ALIGN_CENTER.
    +    */
    +    this.align = "left";
    +
    +    /**
    +    * @property {boolean} multiLine - If set to true all carriage-returns in text will form new lines (see align). If false the font will only contain one single line of text (the default)
    +    * @default
    +    */
    +    this.multiLine = false;
    +
    +    /**
    +    * @property {boolean} autoUpperCase - Automatically convert any text to upper case. Lots of old bitmap fonts only contain upper-case characters, so the default is true.
    +    * @default
    +    */
    +    this.autoUpperCase = true;
    +
    +    /**
    +    * @property {number} customSpacingX - Adds horizontal spacing between each character of the font, in pixels.
    +    * @default
    +    */
    +    this.customSpacingX = 0;
    +
    +    /**
    +    * @property {number} customSpacingY - Adds vertical spacing between each line of multi-line text, set in pixels.
    +    * @default
    +    */
    +    this.customSpacingY = 0;
    +
    +    /**
    +    * If you need this BitmapFont image to have a fixed width you can set the width in this value.
    +    * If text is wider than the width specified it will be cropped off.
    +    * @property {number} fixedWidth
    +    */
    +    this.fixedWidth = 0;
    +
    +    /**
    +    * @property {HTMLImage} fontSet - A reference to the image stored in the Game.Cache that contains the font.
    +    */
    +    this.fontSet = game.cache.getImage(key);
    +
    +    /**
    +    * @property {string} _text - The text of the font image.
    +    * @private
    +    */
    +    this._text = '';
    +
    +    /**
    +    * @property {array} grabData - An array of rects for faster character pasting.
    +    * @private
    +    */
    +    this.grabData = [];
    +    
    +    //  Now generate our rects for faster copying later on
    +    var currentX = this.offsetX;
    +    var currentY = this.offsetY;
    +    var r = 0;
    +    var data = new Phaser.FrameData();
    +    
    +    for (var c = 0; c < chars.length; c++)
    +    {
    +        var uuid = game.rnd.uuid();
    +
    +        var frame = data.addFrame(new Phaser.Frame(c, currentX, currentY, this.characterWidth, this.characterHeight, '', uuid));
    +
    +        this.grabData[chars.charCodeAt(c)] = frame.index;
    +
    +        PIXI.TextureCache[uuid] = new PIXI.Texture(PIXI.BaseTextureCache[key], {
    +            x: currentX,
    +            y: currentY,
    +            width: this.characterWidth,
    +            height: this.characterHeight
    +        });
    +        
    +        r++;
    +        
    +        if (r == this.characterPerRow)
    +        {
    +            r = 0;
    +            currentX = this.offsetX;
    +            currentY += this.characterHeight + this.characterSpacingY;
    +        }
    +        else
    +        {
    +            currentX += this.characterWidth + this.characterSpacingX;
    +        }
    +    }
    +
    +    game.cache.updateFrameData(key, data);
    +
    +    this.stamp = new Phaser.Image(game, 0, 0, key, 0);
    +
    +    Phaser.RenderTexture.call(this, game);
    +
    +    /**
    +    * @property {number} type - Base Phaser object type. 
    +    */
    +    this.type = Phaser.BITMAPFONT;
    +    
    +};
    +
    +Phaser.BitmapFont.prototype = Object.create(Phaser.RenderTexture.prototype);
    +Phaser.BitmapFont.prototype.constructor = Phaser.BitmapFont;
    +
    +/**
    +* Align each line of multi-line text to the left.
    +* @constant
    +* @type {string}
    +*/
    +Phaser.BitmapFont.ALIGN_LEFT = "left";
    +        
    +/**
    +* Align each line of multi-line text to the right.
    +* @constant
    +* @type {string}
    +*/
    +Phaser.BitmapFont.ALIGN_RIGHT = "right";
    +        
    +/**
    +* Align each line of multi-line text in the center.
    +* @constant
    +* @type {string}
    +*/
    +Phaser.BitmapFont.ALIGN_CENTER = "center";
    +        
    +/**
    +* Text Set 1 = !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
    +* @constant
    +* @type {string}
    +*/
    +Phaser.BitmapFont.TEXT_SET1 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
    +        
    +/**
    +* Text Set 2 =  !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ
    +* @constant
    +* @type {string}
    +*/
    +Phaser.BitmapFont.TEXT_SET2 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    +        
    +/**
    +* Text Set 3 = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 
    +* @constant
    +* @type {string}
    +*/
    +Phaser.BitmapFont.TEXT_SET3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
    +        
    +/**
    +* Text Set 4 = ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789
    +* @constant
    +* @type {string}
    +*/
    +Phaser.BitmapFont.TEXT_SET4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789";
    +        
    +/**
    +* Text Set 5 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789
    +* @constant
    +* @type {string}
    +*/
    +Phaser.BitmapFont.TEXT_SET5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789";
    +        
    +/**
    +* Text Set 6 = ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' 
    +* @constant
    +* @type {string}
    +*/
    +Phaser.BitmapFont.TEXT_SET6 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ";
    +        
    +/**
    +* Text Set 7 = AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39
    +* @constant
    +* @type {string}
    +*/
    +Phaser.BitmapFont.TEXT_SET7 = "AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39";
    +        
    +/**
    +* Text Set 8 = 0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ
    +* @constant
    +* @type {string}
    +*/
    +Phaser.BitmapFont.TEXT_SET8 = "0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    +        
    +/**
    +* Text Set 9 = ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!
    +* @constant
    +* @type {string}
    +*/
    +Phaser.BitmapFont.TEXT_SET9 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!";
    +        
    +/**
    +* Text Set 10 = ABCDEFGHIJKLMNOPQRSTUVWXYZ
    +* @constant
    +* @type {string}
    +*/
    +Phaser.BitmapFont.TEXT_SET10 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    +        
    +/**
    +* Text Set 11 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789
    +* @constant
    +* @type {string}
    +*/
    +Phaser.BitmapFont.TEXT_SET11 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789";
    +
    +/**
    +* If you need this FlxSprite to have a fixed width and custom alignment you can set the width here.<br>
    +* If text is wider than the width specified it will be cropped off.
    +*
    +* @method Phaser.BitmapFont#setFixedWidth
    +* @memberof Phaser.BitmapFont
    +* @param {number} width - Width in pixels of this BitmapFont. Set to zero to disable and re-enable automatic resizing.
    +* @param {string} [lineAlignment='left'] - Align the text within this width. Set to BitmapFont.ALIGN_LEFT (default), BitmapFont.ALIGN_RIGHT or BitmapFont.ALIGN_CENTER.
    +*/
    +Phaser.BitmapFont.prototype.setFixedWidth = function (width, lineAlignment) { 
    +
    +    if (typeof lineAlignment === 'undefined') { lineAlignment = 'left'; }
    +
    +    this.fixedWidth = width;
    +    this.align = lineAlignment;
    +
    +}
    +
    +/**
    +* A helper function that quickly sets lots of variables at once, and then updates the text.
    +* 
    +* @method Phaser.BitmapFont#setText
    +* @memberof Phaser.BitmapFont
    +* @param {string} content - The text of this sprite.
    +* @param {boolean} [multiLine=false] - Set to true if you want to support carriage-returns in the text and create a multi-line sprite instead of a single line.
    +* @param {number} [characterSpacing=0] - To add horizontal spacing between each character specify the amount in pixels.
    +* @param {number} [lineSpacing=0] - To add vertical spacing between each line of text, set the amount in pixels.
    +* @param {string} [lineAlignment='left'] - Align each line of multi-line text. Set to BitmapFont.ALIGN_LEFT, BitmapFont.ALIGN_RIGHT or BitmapFont.ALIGN_CENTER.
    +* @param {boolean} [allowLowerCase=false] - Lots of bitmap font sets only include upper-case characters, if yours needs to support lower case then set this to true.
    +*/
    +Phaser.BitmapFont.prototype.setText = function (content, multiLine, characterSpacing, lineSpacing, lineAlignment, allowLowerCase) {
    +
    +    this.multiLine = multiLine || false;
    +    this.customSpacingX = characterSpacing || 0;
    +    this.customSpacingY = lineSpacing || 0;
    +    this.align = lineAlignment || 'left';
    +    
    +    if (allowLowerCase)
    +    {
    +        this.autoUpperCase = false;
    +    }
    +    else
    +    {
    +        this.autoUpperCase = true;
    +    }
    +    
    +    if (content.length > 0)
    +    {
    +        this.text = content;
    +    }
    +
    +}
    +
    +/**
    +* Over rides the default PIXI.RenderTexture resize event as we need our baseTexture resized as well.
    +* 
    +* @method Phaser.BitmapFont#resize
    +* @memberof Phaser.BitmapFont
    +*/
    +Phaser.BitmapFont.prototype.resize = function (width, height) {
    +
    +    this.width = width;
    +    this.height = height;
    +
    +    this.frame.width = this.width;
    +    this.frame.height = this.height;
    +
    +    this.baseTexture.width = this.width;
    +    this.baseTexture.height = this.height;
    +
    +    if (this.renderer.type === PIXI.WEBGL_RENDERER)
    +    {
    +        this.projection.x = this.width / 2;
    +        this.projection.y = -this.height / 2;
    +
    +        var gl = this.renderer.gl;
    +        gl.bindTexture(gl.TEXTURE_2D, this.baseTexture._glTextures[gl.id]);
    +        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA,  this.width,  this.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
    +    }
    +    else
    +    {
    +        this.textureBuffer.resize(this.width, this.height);
    +    }
    +
    +    PIXI.Texture.frameUpdates.push(this);
    +
    +}
    +
    +/**
    +* Updates the BitmapData of the Sprite with the text
    +* 
    +* @method Phaser.BitmapFont#buildBitmapFontText
    +* @memberof Phaser.BitmapFont
    +*/
    +Phaser.BitmapFont.prototype.buildBitmapFontText = function () { 
    +
    +    var cx = 0;
    +    var cy = 0;
    +
    +    if (this.multiLine)
    +    {
    +        var lines = this._text.split("\n");
    +    
    +        if (this.fixedWidth > 0)
    +        {
    +            this.resize(fixedWidth, (lines.length * (this.characterHeight + this.customSpacingY)) - this.customSpacingY);
    +        }
    +        else
    +        {
    +            this.resize(this.getLongestLine() * (this.characterWidth + this.customSpacingX), (lines.length * (this.characterHeight + this.customSpacingY)) - this.customSpacingY);
    +        }
    +
    +        this.textureBuffer.clear();
    +        
    +        //  Loop through each line of text
    +        for (var i = 0; i < lines.length; i++)
    +        {
    +            //  This line of text is held in lines[i] - need to work out the alignment
    +            switch (this.align)
    +            {
    +                case Phaser.BitmapFont.ALIGN_LEFT:
    +                    cx = 0;
    +                    break;
    +                    
    +                case Phaser.BitmapFont.ALIGN_RIGHT:
    +                    cx = this.width - (lines[i].length * (this.characterWidth + this.customSpacingX));
    +                    break;
    +                    
    +                case Phaser.BitmapFont.ALIGN_CENTER:
    +                    cx = (this.width / 2) - ((lines[i].length * (this.characterWidth + this.customSpacingX)) / 2);
    +                    cx += this.customSpacingX / 2;
    +                    break;
    +            }
    +            
    +            //  Sanity checks
    +            if (cx < 0)
    +            {
    +                cx = 0;
    +            }
    +            
    +            this.pasteLine(lines[i], cx, cy, this.customSpacingX);
    +            
    +            cy += this.characterHeight + this.customSpacingY;
    +        }
    +    }
    +    else
    +    {
    +        if (this.fixedWidth > 0)
    +        {
    +            this.resize(fixedWidth, this.characterHeight);
    +        }
    +        else
    +        {
    +            this.resize(this._text.length * (this.characterWidth + this.customSpacingX), this.characterHeight);
    +        }
    +
    +        this.textureBuffer.clear();
    +        
    +        switch (this.align)
    +        {
    +            case Phaser.BitmapFont.ALIGN_LEFT:
    +                cx = 0;
    +                break;
    +                
    +            case Phaser.BitmapFont.ALIGN_RIGHT:
    +                cx = this.width - (this._text.length * (this.characterWidth + this.customSpacingX));
    +                break;
    +                
    +            case Phaser.BitmapFont.ALIGN_CENTER:
    +                cx = (this.width / 2) - ((this._text.length * (this.characterWidth + this.customSpacingX)) / 2);
    +                cx += this.customSpacingX / 2;
    +                break;
    +        }
    +    
    +        this.pasteLine(this._text, cx, 0, this.customSpacingX);
    +    }
    +
    +}
    +
    +/**
    +* Internal function that takes a single line of text (2nd parameter) and pastes it into the BitmapData at the given coordinates.
    +* Used by getLine and getMultiLine
    +* 
    +* @method Phaser.BitmapFont#buildBitmapFontText
    +* @memberof Phaser.BitmapFont
    +* @param {string} line - The single line of text to paste.
    +* @param {number} x - The x coordinate.
    +* @param {number} y - The y coordinate.
    +* @param {number} customSpacingX - Custom X spacing.
    +*/
    +Phaser.BitmapFont.prototype.pasteLine = function (line, x, y, customSpacingX) { 
    +
    +    var p = new Phaser.Point();
    +
    +    for (var c = 0; c < line.length; c++)
    +    {
    +        //  If it's a space then there is no point copying, so leave a blank space
    +        if (line.charAt(c) == " ")
    +        {
    +            x += this.characterWidth + this.customSpacingX;
    +        }
    +        else
    +        {
    +            //  If the character doesn't exist in the font then we don't want a blank space, we just want to skip it
    +            if (this.grabData[line.charCodeAt(c)] >= 0)
    +            {
    +                this.stamp.frame = this.grabData[line.charCodeAt(c)];
    +                p.set(x, y);
    +                this.render(this.stamp, p, false);
    +                
    +                x += this.characterWidth + this.customSpacingX;
    +                
    +                if (x > this.width)
    +                {
    +                    break;
    +                }
    +            }
    +        }
    +    }
    +}
    +        
    +/**
    +* Works out the longest line of text in _text and returns its length
    +* 
    +* @method Phaser.BitmapFont#getLongestLine
    +* @memberof Phaser.BitmapFont
    +* @return {number} The length of the longest line of text.
    +*/
    +Phaser.BitmapFont.prototype.getLongestLine = function () { 
    +
    +    var longestLine = 0;
    +    
    +    if (this._text.length > 0)
    +    {
    +        var lines = this._text.split("\n");
    +        
    +        for (var i = 0; i < lines.length; i++)
    +        {
    +            if (lines[i].length > longestLine)
    +            {
    +                longestLine = lines[i].length;
    +            }
    +        }
    +    }
    +    
    +    return longestLine;
    +}
    +        
    +/**
    +* Internal helper function that removes all unsupported characters from the _text String, leaving only characters contained in the font set.
    +* 
    +* @method Phaser.BitmapFont#removeUnsupportedCharacters
    +* @memberof Phaser.BitmapFont
    +* @protected
    +* @param {boolean} [stripCR=true] - Should it strip carriage returns as well?
    +* @return {string}  A clean version of the string.
    +*/
    +Phaser.BitmapFont.prototype.removeUnsupportedCharacters = function (stripCR) { 
    +
    +    var newString = "";
    +    
    +    for (var c = 0; c < this._text.length; c++)
    +    {
    +        var char = this._text[c];
    +        var code = char.charCodeAt(0);
    +
    +        if (this.grabData[code] >= 0 || (!stripCR && char === "\n"))
    +        {
    +            newString = newString.concat(char);
    +        }
    +    }
    +    
    +    return newString;
    +}
    +
    +/**
    +* @name Phaser.BitmapText#text
    +* @property {string} text - Set this value to update the text in this sprite. Carriage returns are automatically stripped out if multiLine is false. Text is converted to upper case if autoUpperCase is true.
    +*/
    +Object.defineProperty(Phaser.BitmapFont.prototype, "text", {
    +    
    +    get: function () {
    +
    +        return this._text;
    +
    +    },
    +
    +    set: function (value) {
    +
    +        var newText;
    +        
    +        if (this.autoUpperCase)
    +        {
    +            newText = value.toUpperCase();
    +        }
    +        else
    +        {
    +            newText = value;
    +        }
    +        
    +        if (newText !== this._text)
    +        {
    +            this._text = newText;
    +            
    +            this.removeUnsupportedCharacters(this.multiLine);
    +            
    +            this.buildBitmapFontText();
    +        }
    +
    +    }
    +
    +});
    +
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2014 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.3.0-dev + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/docs/BitmapText.js.html b/docs/BitmapText.js.html index ceb2e4b4..0831dfa1 100644 --- a/docs/BitmapText.js.html +++ b/docs/BitmapText.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -463,22 +471,24 @@ * @classdesc BitmapText objects work by taking a texture file and an XML file that describes the font layout. * * On Windows you can use the free app BMFont: http://www.angelcode.com/products/bmfont/ -* * On OS X we recommend Glyph Designer: http://www.71squared.com/en/glyphdesigner +* For Web there is the great Littera: http://kvazars.com/littera/ * * @constructor * @param {Phaser.Game} game - A reference to the currently running game. * @param {number} x - X position of the new bitmapText object. * @param {number} y - Y position of the new bitmapText object. -* @param {string} text - The actual text that will be written. -* @param {object} style - The style object containing style attributes like font, font size , etc. +* @param {string} font - The key of the BitmapFont as stored in Game.Cache. +* @param {string} [text=''] - The actual text that will be rendered. Can be set later via BitmapText.text. +* @param {number} [size=32] - The size the font will be rendered in, in pixels. */ -Phaser.BitmapText = function (game, x, y, text, style) { +Phaser.BitmapText = function (game, x, y, font, text, size) { x = x || 0; y = y || 0; + font = font || ''; text = text || ''; - style = style || ''; + size = size || 32; /** * @property {Phaser.Game} game - A reference to the currently running Game. @@ -491,17 +501,6 @@ Phaser.BitmapText = function (game, x, y, text, style) { */ 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 BitmapText. - */ - this.group = null; - /** * @property {string} name - The user defined name given to this BitmapText. * @default @@ -514,62 +513,74 @@ Phaser.BitmapText = function (game, x, y, text, style) { */ this.type = Phaser.BITMAPTEXT; - PIXI.BitmapText.call(this, text, style); + /** + * @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); /** - * @property {number} position.x - The x position of this object. - */ - this.position.x = x; - - /** - * @property {number} position.y - The y position of this object. - */ - this.position.y = y; - - /** - * 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(); - - /** - * @property {Phaser.Point} scale - The scale of the object 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. - */ - this.scale = new Phaser.Point(1, 1); - - /** - * @property {object} _cache - A mini cache for storing all of the calculated values. + * @property {string} _text - Internal cache var. * @private */ - this._cache = { + this._text = text; - dirty: false, + /** + * @property {string} _font - Internal cache var. + * @private + */ + this._font = font; - // Transform cache - a00: 1, - a01: 0, - a02: x, - a10: 0, - a11: 1, - a12: y, - id: 1, + /** + * @property {number} _fontSize - Internal cache var. + * @private + */ + this._fontSize = size; - // The previous calculated position - x: -1, - y: -1, + /** + * @property {string} _align - Internal cache var. + * @private + */ + this._align = 'left'; - // The actual scale values based on the worldTransform - scaleX: 1, - scaleY: 1 + /** + * @property {number} _tint - Internal cache var. + * @private + */ + this._tint = 0xFFFFFF; - }; + /** + * @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); - this._cache.x = this.x; - this._cache.y = this.y; + /** + * @property {Phaser.InputHandler|null} input - The Input Handler for this object. Needs to be enabled with image.inputEnabled = true before you can use it. + */ + this.input = null; + + /** + * @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view. + */ + this.cameraOffset = new Phaser.Point(); + + PIXI.BitmapText.call(this, text); + + this.position.set(x, y); + + /** + * A small internal cache: + * 0 = previous position.x + * 1 = previous position.y + * 2 = previous rotation + * 3 = renderID + * 4 = fresh? (0 = no, 1 = yes) + * 5 = outOfBoundsFired (0 = no, 1 = yes) + * 6 = exists (0 = no, 1 = yes) + * 7 = fixed to camera (0 = no, 1 = yes) + * @property {Int16Array} _cache + * @private + */ + this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0]); }; @@ -577,61 +588,153 @@ Phaser.BitmapText.prototype = Object.create(PIXI.BitmapText.prototype); Phaser.BitmapText.prototype.constructor = Phaser.BitmapText; /** -* Automatically called by World.update -* @method Phaser.BitmapText.prototype.update +* @method setStyle +* @private +*/ +Phaser.BitmapText.prototype.setStyle = function() { + + this.style = { align: this._align }; + this.fontName = this._font; + this.fontSize = this._fontSize; + this.dirty = true; + +}; + +/** +* Automatically called by World.preUpdate. +* @method Phaser.BitmapText.prototype.preUpdate +*/ +Phaser.BitmapText.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; + +} + +/** +* Override and use this function in your own custom objects to handle any update requirements you may have. +* +* @method Phaser.BitmapText#update +* @memberof Phaser.BitmapText */ Phaser.BitmapText.prototype.update = function() { - if (!this.exists) +} + +/** +* Automatically called by World.postUpdate. +* @method Phaser.BitmapText.prototype.postUpdate +*/ +Phaser.BitmapText.prototype.postUpdate = function () { + + // Fixed to Camera? + if (this._cache[7] === 1) { - return; + this.position.x = this.game.camera.view.x + this.cameraOffset.x; + this.position.y = this.game.camera.view.y + this.cameraOffset.y; } - this._cache.dirty = false; - - this._cache.x = this.x; - this._cache.y = this.y; - - if (this.position.x != this._cache.x || this.position.y != this._cache.y) - { - this.position.x = this._cache.x; - this.position.y = this._cache.y; - this._cache.dirty = true; - } - - this.pivot.x = this.anchor.x * this.width; - this.pivot.y = this.anchor.y * this.height; - } /** -* @method Phaser.Text.prototype.destroy +* @method Phaser.BitmapText.prototype.destroy */ Phaser.BitmapText.prototype.destroy = function() { - if (this.group) + if (this.filters) { - this.group.remove(this); + this.filters = null; } - if (this.canvas && this.canvas.parentNode) + if (this.parent) { - this.canvas.parentNode.removeChild(this.canvas); - } - else - { - this.canvas = null; - this.context = null; + this.parent.remove(this); } this.exists = false; + this.visible = false; - this.group = null; + this.game = null; + + if (this.children.length > 0) + { + do + { + this.removeChild(this.children[0]); + } + while (this.children.length > 0); + } } /** -* Indicates the rotation of the BitmapText, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. +* @name Phaser.BitmapText#align +* @property {string} align - Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text. +*/ +Object.defineProperty(Phaser.BitmapText.prototype, 'align', { + + get: function() { + return this._align; + }, + + set: function(value) { + + if (value !== this._align) + { + this._align = value; + this.setStyle(); + } + + } + +}); + +/** +* @name Phaser.BitmapText#tint +* @property {number} tint - The tint applied to the BitmapText. This is a hex value. Set to white to disable (0xFFFFFF) +*/ +Object.defineProperty(Phaser.BitmapText.prototype, 'tint', { + + get: function() { + return this._tint; + }, + + set: function(value) { + + if (value !== this._tint) + { + this._tint = value; + this.dirty = true; + } + + } + +}); + +/** +* Indicates the rotation of the Text, 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.BitmapText#angle @@ -650,35 +753,139 @@ Object.defineProperty(Phaser.BitmapText.prototype, 'angle', { }); /** -* The x coordinate of this object in world space. -* @name Phaser.BitmapText#x -* @property {number} x - The x coordinate of this object in world space. +* @name Phaser.BitmapText#font +* @property {string} font - The font the text will be rendered in, i.e. 'Arial'. Must be loaded in the browser before use. */ -Object.defineProperty(Phaser.BitmapText.prototype, 'x', { +Object.defineProperty(Phaser.BitmapText.prototype, 'font', { get: function() { - return this.position.x; + return this._font; }, set: function(value) { - this.position.x = value; + + if (value !== this._font) + { + this._font = value.trim(); + this.style.font = this._fontSize + "px '" + this._font + "'"; + this.dirty = true; + } + } }); /** -* The y coordinate of this object in world space. -* @name Phaser.BitmapText#y -* @property {number} y - The y coordinate of this object in world space. +* @name Phaser.BitmapText#fontSize +* @property {number} fontSize - The size of the font in pixels. */ -Object.defineProperty(Phaser.BitmapText.prototype, 'y', { +Object.defineProperty(Phaser.BitmapText.prototype, 'fontSize', { get: function() { - return this.position.y; + return this._fontSize; }, set: function(value) { - this.position.y = value; + + value = parseInt(value); + + if (value !== this._fontSize) + { + this._fontSize = value; + this.style.font = this._fontSize + "px '" + this._font + "'"; + this.dirty = true; + } + + } + +}); + +/** +* The text string to be displayed by this Text object, taking into account the style settings. +* @name Phaser.BitmapText#text +* @property {string} text - The text string to be displayed by this Text object, taking into account the style settings. +*/ +Object.defineProperty(Phaser.BitmapText.prototype, 'text', { + + get: function() { + return this._text; + }, + + set: function(value) { + + if (value !== this._text) + { + this._text = value.toString() || ' '; + this.dirty = true; + } + + } + +}); + +/** +* By default a Text object 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.BitmapText#inputEnabled +* @property {boolean} inputEnabled - Set to true to allow this object to receive input events. +*/ +Object.defineProperty(Phaser.BitmapText.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(); + } + } + } + +}); + +/** +* An BitmapText that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in BitmapText.cameraOffset. +* Note that the cameraOffset values are in addition to any parent in the display list. +* So if this BitmapText was in a Group that has x: 200, then this will be added to the cameraOffset.x +* +* @name Phaser.BitmapText#fixedToCamera +* @property {boolean} fixedToCamera - Set to true to fix this BitmapText to the Camera at its current world coordinates. +*/ +Object.defineProperty(Phaser.BitmapText.prototype, "fixedToCamera", { + + get: function () { + + return !!this._cache[7]; + + }, + + set: function (value) { + + if (value) + { + this._cache[7] = 1; + this.cameraOffset.set(this.x, this.y); + } + else + { + this._cache[7] = 0; + } } }); @@ -703,7 +910,7 @@ Object.defineProperty(Phaser.BitmapText.prototype, 'y', { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Button.js.html b/docs/Button.js.html index 2b3f7cab..f44bc6e0 100644 --- a/docs/Button.js.html +++ b/docs/Button.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1107,7 +1115,7 @@ Phaser.Button.prototype.setState = function (newState) { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Cache.js.html b/docs/Cache.js.html index e7c4fb23..2765d535 100644 --- a/docs/Cache.js.html +++ b/docs/Cache.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -500,6 +508,12 @@ Phaser.Cache = function (game) { */ this._text = {}; + /** + * @property {object} _physics - Physics data key-value container. + * @private + */ + this._physics = {}; + /** * @property {object} _tilemaps - Tilemap key-value container. * @private @@ -518,6 +532,12 @@ Phaser.Cache = function (game) { */ this._bitmapDatas = {}; + /** + * @property {object} _bitmapFont - BitmapFont key-value container. + * @private + */ + this._bitmapFont = {}; + this.addDefaultImage(); this.addMissingImage(); @@ -528,10 +548,71 @@ Phaser.Cache = function (game) { }; +/** +* @constant +* @type {number} +*/ +Phaser.Cache.CANVAS = 1; + +/** +* @constant +* @type {number} +*/ +Phaser.Cache.IMAGE = 2; + +/** +* @constant +* @type {number} +*/ +Phaser.Cache.TEXTURE = 3; + +/** +* @constant +* @type {number} +*/ +Phaser.Cache.SOUND = 4; + +/** +* @constant +* @type {number} +*/ +Phaser.Cache.TEXT = 5; + +/** +* @constant +* @type {number} +*/ +Phaser.Cache.PHYSICS = 6; + +/** +* @constant +* @type {number} +*/ +Phaser.Cache.TILEMAP = 7; + +/** +* @constant +* @type {number} +*/ +Phaser.Cache.BINARY = 8; + +/** +* @constant +* @type {number} +*/ +Phaser.Cache.BITMAPDATA = 9; + +/** +* @constant +* @type {number} +*/ +Phaser.Cache.BITMAPFONT = 10; + Phaser.Cache.prototype = { /** * Add a new canvas object in to the cache. + * * @method Phaser.Cache#addCanvas * @param {string} key - Asset key for this canvas. * @param {HTMLCanvasElement} canvas - Canvas DOM element. @@ -545,6 +626,7 @@ Phaser.Cache.prototype = { /** * Add a binary object in to the cache. + * * @method Phaser.Cache#addBinary * @param {string} key - Asset key for this binary data. * @param {object} binaryData - The binary object to be addded to the cache. @@ -557,6 +639,7 @@ Phaser.Cache.prototype = { /** * Add a BitmapData object in to the cache. + * * @method Phaser.Cache#addBitmapData * @param {string} key - Asset key for this BitmapData. * @param {Phaser.BitmapData} bitmapData - The BitmapData object to be addded to the cache. @@ -585,6 +668,19 @@ Phaser.Cache.prototype = { }, + /** + * Add a Phaser.BitmapFont in to the cache. + * + * @method Phaser.Cache#addBitmapFont + * @param {string} key - The unique key by which you will reference this object. + * @param {Phaser.BitmapFont} texture - The BitmapFont object to be stored. This can be applied to any Image/Sprite as a texture. + */ + addBitmapFont: function (key, texture) { + + this._bitmapFont[key] = texture; + + }, + /** * Add a new sprite sheet in to the cache. * @@ -610,7 +706,7 @@ Phaser.Cache.prototype = { }, /** - * Add a new tilemap. + * Add a new tilemap to the Cache. * * @method Phaser.Cache#addTilemap * @param {string} key - The unique key by which you will reference this object. @@ -625,7 +721,7 @@ Phaser.Cache.prototype = { }, /** - * Add a new texture atlas. + * Add a new texture atlas to the Cache. * * @method Phaser.Cache#addTextureAtlas * @param {string} key - The unique key by which you will reference this object. @@ -657,23 +753,39 @@ Phaser.Cache.prototype = { }, /** - * Add a new Bitmap Font. + * Add a new Bitmap Font to the Cache. * * @method Phaser.Cache#addBitmapFont * @param {string} key - The unique key by which you will reference this object. * @param {string} url - URL of this font xml file. * @param {object} data - Extra font data. - * @param xmlData {object} Texture atlas frames data. + * @param {object} xmlData - Texture atlas frames data. + * @param {number} [xSpacing=0] - If you'd like to add additional horizontal spacing between the characters then set the pixel value here. + * @param {number} [ySpacing=0] - If you'd like to add additional vertical spacing between the lines then set the pixel value here. */ - addBitmapFont: function (key, url, data, xmlData) { + addBitmapFont: function (key, url, data, xmlData, xSpacing, ySpacing) { this._images[key] = { url: url, data: data, spriteSheet: true }; PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data); PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]); - Phaser.LoaderParser.bitmapFont(this.game, xmlData, key); - // this._images[key].frameData = Phaser.AnimationParser.XMLData(this.game, xmlData, key); + Phaser.LoaderParser.bitmapFont(this.game, xmlData, key, xSpacing, ySpacing); + + }, + + /** + * Add a new physics data object to the Cache. + * + * @method Phaser.Cache#addTilemap + * @param {string} key - The unique key by which you will reference this object. + * @param {string} url - URL of the physics json data. + * @param {object} JSONData - The physics data object (a JSON file). + * @param {number} format - The format of the physics data. + */ + addPhysicsData: function (key, url, JSONData, format) { + + this._physics[key] = { url: url, data: JSONData, format: format }; }, @@ -681,6 +793,7 @@ Phaser.Cache.prototype = { * Adds a default image to be used in special cases such as WebGL Filters. Is mapped to the key __default. * * @method Phaser.Cache#addDefaultImage + * @protected */ addDefaultImage: function () { @@ -699,6 +812,7 @@ Phaser.Cache.prototype = { * Adds an image to be used when a key is wrong / missing. Is mapped to the key __missing. * * @method Phaser.Cache#addMissingImage + * @protected */ addMissingImage: function () { @@ -723,10 +837,7 @@ Phaser.Cache.prototype = { */ addText: function (key, url, data) { - this._text[key] = { - url: url, - data: data - }; + this._text[key] = { url: url, data: data }; }, @@ -883,6 +994,64 @@ Phaser.Cache.prototype = { }, + /** + * Get a BitmapFont object from the cache by its key. + * + * @method Phaser.Cache#getBitmapFont + * @param {string} key - Asset key of the BitmapFont object to retrieve from the Cache. + * @return {Phaser.BitmapFont} The requested BitmapFont object if found, or null if not. + */ + getBitmapFont: function (key) { + + if (this._bitmapFont[key]) + { + return this._bitmapFont[key]; + } + else + { + console.warn('Phaser.Cache.getBitmapFont: Invalid key: "' + key + '"'); + } + + }, + + /** + * Get a physics data object from the cache by its key. You can get either the entire data set or just a single object from it. + * + * @method Phaser.Cache#getPhysicsData + * @param {string} key - Asset key of the physics data object to retrieve from the Cache. + * @param {string} [object=null] - If specified it will return just the physics object that is part of the given key, if null it will return them all. + * @return {object} The requested physics object data if found. + */ + getPhysicsData: function (key, object) { + + if (typeof object === 'undefined' || object === null) + { + // Get 'em all + if (this._physics[key]) + { + return this._physics[key].data; + } + else + { + console.warn('Phaser.Cache.getPhysicsData: Invalid key: "' + key + '"'); + } + } + else + { + if (this._physics[key] && this._physics[key].data[object]) + { + return this._physics[key].data[object][0]; + } + else + { + console.warn('Phaser.Cache.getPhysicsData: Invalid key/object: "' + key + ' / ' + object + '"'); + } + } + + return null; + + }, + /** * Checks if an image key exists. * @@ -958,6 +1127,23 @@ Phaser.Cache.prototype = { return null; }, + /** + * Replaces a set of frameData with a new Phaser.FrameData object. + * + * @method Phaser.Cache#updateFrameData + * @param {string} key - The unique key by which you will reference this object. + * @param {number} frameData - The new FrameData. + */ + updateFrameData: function (key, frameData) { + + if (this._images[key]) + { + this._images[key].spriteSheet = true; + this._images[key].frameData = frameData; + } + + }, + /** * Get a single frame out of a frameData set by key. * @@ -1174,14 +1360,63 @@ Phaser.Cache.prototype = { }, /** - * Get the cache keys from a given array of objects. - * Normally you don't call this directly but instead use getImageKeys, getSoundKeys, etc. + * Gets all keys used by the Cache for the given data type. * * @method Phaser.Cache#getKeys - * @param {Array} array - An array of items to return the keys for. + * @param {number} [type=Phaser.Cache.IMAGE] - The type of Cache keys you wish to get. Can be Cache.CANVAS, Cache.IMAGE, Cache.SOUND, etc. * @return {Array} The array of item keys. */ - getKeys: function (array) { + getKeys: function (type) { + + var array = null; + + switch (type) + { + case Phaser.Cache.CANVAS: + array = this._canvases; + break; + + case Phaser.Cache.IMAGE: + array = this._images; + break; + + case Phaser.Cache.TEXTURE: + array = this._textures; + break; + + case Phaser.Cache.SOUND: + array = this._sounds; + break; + + case Phaser.Cache.TEXT: + array = this._text; + break; + + case Phaser.Cache.PHYSICS: + array = this._physics; + break; + + case Phaser.Cache.TILEMAP: + array = this._tilemaps; + break; + + case Phaser.Cache.BINARY: + array = this._binary; + break; + + case Phaser.Cache.BITMAPDATA: + array = this._bitmapDatas; + break; + + case Phaser.Cache.BITMAPFONT: + array = this._bitmapFont; + break; + } + + if (!array) + { + return; + } var output = []; @@ -1197,36 +1432,6 @@ Phaser.Cache.prototype = { }, - /** - * Returns an array containing all of the keys of Images in the Cache. - * - * @method Phaser.Cache#getImageKeys - * @return {Array} The string based keys in the Cache. - */ - getImageKeys: function () { - return this.getKeys(this._images); - }, - - /** - * Returns an array containing all of the keys of Sounds in the Cache. - * - * @method Phaser.Cache#getSoundKeys - * @return {Array} The string based keys in the Cache. - */ - getSoundKeys: function () { - return this.getKeys(this._sounds); - }, - - /** - * Returns an array containing all of the keys of Text Files in the Cache. - * - * @method Phaser.Cache#getTextKeys - * @return {Array} The string based keys in the Cache. - */ - getTextKeys: function () { - return this.getKeys(this._text); - }, - /** * Removes a canvas from the cache. * @@ -1267,6 +1472,56 @@ Phaser.Cache.prototype = { delete this._text[key]; }, + /** + * Removes a physics data file from the cache. + * + * @method Phaser.Cache#removePhysics + * @param {string} key - Key of the asset you want to remove. + */ + removePhysics: function (key) { + delete this._text[key]; + }, + + /** + * Removes a tilemap from the cache. + * + * @method Phaser.Cache#removeTilemap + * @param {string} key - Key of the asset you want to remove. + */ + removeTilemap: function (key) { + delete this._text[key]; + }, + + /** + * Removes a binary file from the cache. + * + * @method Phaser.Cache#removeBinary + * @param {string} key - Key of the asset you want to remove. + */ + removeBinary: function (key) { + delete this._text[key]; + }, + + /** + * Removes a bitmap data from the cache. + * + * @method Phaser.Cache#removeBitmapData + * @param {string} key - Key of the asset you want to remove. + */ + removeBitmapData: function (key) { + delete this._text[key]; + }, + + /** + * Removes a bitmap font from the cache. + * + * @method Phaser.Cache#removeBitmapFont + * @param {string} key - Key of the asset you want to remove. + */ + removeBitmapFont: function (key) { + delete this._text[key]; + }, + /** * Clears the cache. Removes every local cache object reference. * @@ -1293,6 +1548,37 @@ Phaser.Cache.prototype = { { delete this._text[item['key']]; } + + for (var item in this._textures) + { + delete this._textures[item['key']]; + } + + for (var item in this._physics) + { + delete this._physics[item['key']]; + } + + for (var item in this._tilemaps) + { + delete this._tilemaps[item['key']]; + } + + for (var item in this._binary) + { + delete this._binary[item['key']]; + } + + for (var item in this._bitmapDatas) + { + delete this._bitmapDatas[item['key']]; + } + + for (var item in this._bitmapFont) + { + delete this._bitmapFont[item['key']]; + } + } }; @@ -1319,7 +1605,7 @@ Phaser.Cache.prototype.constructor = Phaser.Cache; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Camera.js.html b/docs/Camera.js.html index d6988af3..e6ce7a92 100644 --- a/docs/Camera.js.html +++ b/docs/Camera.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -781,6 +789,19 @@ Phaser.Camera.prototype = { this.view.width = width; this.view.height = height; + }, + + /** + * Resets the camera back to 0,0 and un-follows any object it may have been tracking. + * + * @method Phaser.Camera#reset + */ + reset: function () { + + this.target = null; + this.view.x = 0; + this.view.y = 0; + } }; @@ -887,7 +908,7 @@ Object.defineProperty(Phaser.Camera.prototype, "height", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Canvas.js.html b/docs/Canvas.js.html index 76fbb8ea..c734775e 100644 --- a/docs/Canvas.js.html +++ b/docs/Canvas.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -756,7 +764,7 @@ Phaser.Canvas = { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Circle.js.html b/docs/Circle.js.html index 1c24a00e..75aba600 100644 --- a/docs/Circle.js.html +++ b/docs/Circle.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -522,11 +530,14 @@ Phaser.Circle.prototype = { * @return {Circle} This circle object. */ setTo: function (x, y, diameter) { + this.x = x; this.y = y; this._diameter = diameter; this._radius = diameter * 0.5; + return this; + }, /** @@ -536,7 +547,9 @@ Phaser.Circle.prototype = { * @return {Circle} This Circle object. */ copyFrom: function (source) { + return this.setTo(source.x, source.y, source.diameter); + }, /** @@ -545,11 +558,14 @@ Phaser.Circle.prototype = { * @param {any} dest - The object to copy to. * @return {Object} This dest object. */ - copyTo: function(dest) { + copyTo: function (dest) { + dest.x = this.x; dest.y = this.y; dest.diameter = this._diameter; + return dest; + }, /** @@ -581,7 +597,7 @@ Phaser.Circle.prototype = { * @param {Phaser.Circle} out - Optional Circle object. If given the values will be set into the object, otherwise a brand new Circle object will be created and returned. * @return {Phaser.Circle} The cloned Circle object. */ - clone: function(out) { + clone: function (out) { if (typeof out === "undefined") { @@ -604,7 +620,9 @@ Phaser.Circle.prototype = { * @return {boolean} True if the coordinates are within this circle, otherwise false. */ contains: function (x, y) { + return Phaser.Circle.contains(this, x, y); + }, /** @@ -616,7 +634,9 @@ Phaser.Circle.prototype = { * @return {Phaser.Point} The Point object holding the result. */ circumferencePoint: function (angle, asDegrees, out) { + return Phaser.Circle.circumferencePoint(this, angle, asDegrees, out); + }, /** @@ -627,9 +647,12 @@ Phaser.Circle.prototype = { * @return {Circle} This Circle object. */ offset: function (dx, dy) { + this.x += dx; this.y += dy; + return this; + }, /** @@ -667,7 +690,9 @@ Object.defineProperty(Phaser.Circle.prototype, "diameter", { }, set: function (value) { - if (value > 0) { + + if (value > 0) + { this._diameter = value; this._radius = value * 0.5; } @@ -687,10 +712,13 @@ Object.defineProperty(Phaser.Circle.prototype, "radius", { }, set: function (value) { - if (value > 0) { + + if (value > 0) + { this._radius = value; this._diameter = value * 2; } + } }); @@ -707,12 +735,17 @@ Object.defineProperty(Phaser.Circle.prototype, "left", { }, set: function (value) { - if (value > this.x) { + + if (value > this.x) + { this._radius = 0; this._diameter = 0; - } else { + } + else + { this.radius = this.x - value; } + } }); @@ -729,12 +762,17 @@ Object.defineProperty(Phaser.Circle.prototype, "right", { }, set: function (value) { - if (value < this.x) { + + if (value < this.x) + { this._radius = 0; this._diameter = 0; - } else { + } + else + { this.radius = value - this.x; } + } }); @@ -751,12 +789,17 @@ Object.defineProperty(Phaser.Circle.prototype, "top", { }, set: function (value) { - if (value > this.y) { + + if (value > this.y) + { this._radius = 0; this._diameter = 0; - } else { + } + else + { this.radius = this.y - value; } + } }); @@ -774,12 +817,16 @@ Object.defineProperty(Phaser.Circle.prototype, "bottom", { set: function (value) { - if (value < this.y) { + if (value < this.y) + { this._radius = 0; this._diameter = 0; - } else { + } + else + { this.radius = value - this.y; } + } }); @@ -793,11 +840,16 @@ Object.defineProperty(Phaser.Circle.prototype, "bottom", { Object.defineProperty(Phaser.Circle.prototype, "area", { get: function () { - if (this._radius > 0) { + + if (this._radius > 0) + { return Math.PI * this._radius * this._radius; - } else { + } + else + { return 0; } + } }); @@ -887,7 +939,8 @@ Phaser.Circle.circumferencePoint = function (a, angle, asDegrees, out) { if (typeof asDegrees === "undefined") { asDegrees = false; } if (typeof out === "undefined") { out = new Phaser.Point(); } - if (asDegrees === true) { + if (asDegrees === true) + { angle = Phaser.Math.radToDeg(angle); } @@ -910,18 +963,21 @@ Phaser.Circle.intersectsRectangle = function (c, r) { var cx = Math.abs(c.x - r.x - r.halfWidth); var xDist = r.halfWidth + c.radius; - if (cx > xDist) { + if (cx > xDist) + { return false; } var cy = Math.abs(c.y - r.y - r.halfHeight); var yDist = r.halfHeight + c.radius; - if (cy > yDist) { + if (cy > yDist) + { return false; } - if (cx <= r.halfWidth || cy <= r.halfHeight) { + if (cx <= r.halfWidth || cy <= r.halfHeight) + { return true; } @@ -958,7 +1014,7 @@ PIXI.Circle = Phaser.Circle; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Color.js.html b/docs/Color.js.html index e8c24098..20dedfa6 100644 --- a/docs/Color.js.html +++ b/docs/Color.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -821,7 +829,7 @@ Phaser.Color = { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Debug.js.html b/docs/Debug.js.html index bddeb2ae..62cfb5c7 100644 --- a/docs/Debug.js.html +++ b/docs/Debug.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -665,65 +673,6 @@ Phaser.Utils.Debug.prototype = { }, - /** - * Renders the corners and point information of the given Sprite. - * @method Phaser.Utils.Debug#renderSpriteCorners - * @param {Phaser.Sprite} sprite - The sprite to be rendered. - * @param {boolean} [showText=false] - If true the x/y coordinates of each point will be rendered. - * @param {boolean} [showBounds=false] - If true the bounds will be rendered over the top of the sprite. - * @param {string} [color='rgb(255,0,255)'] - The color the text is rendered in. - */ - renderSpriteCorners: function (sprite, showText, showBounds, color) { - - if (this.context == null) - { - return; - } - - showText = showText || false; - showBounds = showBounds || false; - color = color || 'rgb(255,255,255)'; - - this.start(0, 0, color); - - if (showBounds) - { - this.context.beginPath(); - this.context.strokeStyle = 'rgba(0, 255, 0, 0.7)'; - this.context.strokeRect(sprite.bounds.x, sprite.bounds.y, sprite.bounds.width, sprite.bounds.height); - this.context.closePath(); - this.context.stroke(); - } - - this.context.beginPath(); - this.context.moveTo(sprite.topLeft.x, sprite.topLeft.y); - this.context.lineTo(sprite.topRight.x, sprite.topRight.y); - this.context.lineTo(sprite.bottomRight.x, sprite.bottomRight.y); - this.context.lineTo(sprite.bottomLeft.x, sprite.bottomLeft.y); - this.context.closePath(); - this.context.strokeStyle = 'rgba(255, 0, 255, 0.7)'; - this.context.stroke(); - - this.renderPoint(sprite.offset); - this.renderPoint(sprite.center); - this.renderPoint(sprite.topLeft); - this.renderPoint(sprite.topRight); - this.renderPoint(sprite.bottomLeft); - this.renderPoint(sprite.bottomRight); - - if (showText) - { - this.currentColor = color; - this.line('x: ' + Math.floor(sprite.topLeft.x) + ' y: ' + Math.floor(sprite.topLeft.y), sprite.topLeft.x, sprite.topLeft.y); - this.line('x: ' + Math.floor(sprite.topRight.x) + ' y: ' + Math.floor(sprite.topRight.y), sprite.topRight.x, sprite.topRight.y); - this.line('x: ' + Math.floor(sprite.bottomLeft.x) + ' y: ' + Math.floor(sprite.bottomLeft.y), sprite.bottomLeft.x, sprite.bottomLeft.y); - this.line('x: ' + Math.floor(sprite.bottomRight.x) + ' y: ' + Math.floor(sprite.bottomRight.y), sprite.bottomRight.x, sprite.bottomRight.y); - } - - this.stop(); - - }, - /** * Render Sound information, including decoded state, duration, volume and more. * @method Phaser.Utils.Debug#renderSoundInfo @@ -869,32 +818,6 @@ Phaser.Utils.Debug.prototype = { }, - /** - * Render Sprite Body Physics Data as text. - * @method Phaser.Utils.Debug#renderBodyInfo - * @param {Phaser.Sprite} sprite - The sprite to be rendered. - * @param {number} x - X position of the debug info to be rendered. - * @param {number} y - Y position of the debug info to be rendered. - * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string). - */ - renderBodyInfo: function (sprite, x, y, color) { - - color = color || 'rgb(255,255,255)'; - - this.start(x, y, color, 210); - - this.splitline('x: ' + sprite.body.x.toFixed(2), 'y: ' + sprite.body.y.toFixed(2), 'width: ' + sprite.width, 'height: ' + sprite.height); - this.splitline('speed: ' + sprite.body.speed.toFixed(2), 'angle: ' + sprite.body.angle.toFixed(2), 'linear damping: ' + sprite.body.linearDamping); - this.splitline('blocked left: ' + sprite.body.blocked.left, 'right: ' + sprite.body.blocked.right, 'up: ' + sprite.body.blocked.up, 'down: ' + sprite.body.blocked.down); - this.splitline('touching left: ' + sprite.body.touching.left, 'right: ' + sprite.body.touching.right, 'up: ' + sprite.body.touching.up, 'down: ' + sprite.body.touching.down); - this.splitline('gravity x: ' + sprite.body.gravity.x, 'y: ' + sprite.body.gravity.y, 'world gravity x: ' + this.game.physics.gravity.x, 'y: ' + this.game.physics.gravity.y); - this.splitline('acceleration x: ' + sprite.body.acceleration.x.toFixed(2), 'y: ' + sprite.body.acceleration.y.toFixed(2)); - this.splitline('velocity x: ' + sprite.body.velocity.x.toFixed(2), 'y: ' + sprite.body.velocity.y.toFixed(2), 'deltaX: ' + sprite.body.deltaX().toFixed(2), 'deltaY: ' + sprite.body.deltaY().toFixed(2)); - this.splitline('bounce x: ' + sprite.body.bounce.x.toFixed(2), 'y: ' + sprite.body.bounce.y.toFixed(2)); - this.stop(); - - }, - /** * Render debug information about the Input object. * @method Phaser.Utils.Debug#renderInputInfo @@ -1074,78 +997,6 @@ Phaser.Utils.Debug.prototype = { }, - /** - * Renders just the full Sprite bounds. - * @method Phaser.Utils.Debug#renderSpriteBounds - * @param {Phaser.Sprite} sprite - Description. - * @param {string} [color] - Color of the debug info to be rendered (format is css color string). - * @param {boolean} [fill=false] - If false the bounds outline is rendered, if true the whole rectangle is rendered. - */ - renderSpriteBody: function (sprite, color, fill) { - - if (this.context == null) - { - return; - } - - color = color || 'rgb(255,0,255)'; - - if (typeof fill === 'undefined') { fill = false; } - - this.start(0, 0, color); - - if (fill) - { - this.context.fillStyle = color; - this.context.fillRect(sprite.body.left, sprite.body.top, sprite.body.width, sprite.body.height); - } - else - { - this.context.strokeStyle = color; - this.context.strokeRect(sprite.body.left, sprite.body.top, sprite.body.width, sprite.body.height); - this.context.stroke(); - } - - this.stop(); - - }, - - /** - * Renders just the full Sprite bounds. - * @method Phaser.Utils.Debug#renderSpriteBounds - * @param {Phaser.Sprite} sprite - Description. - * @param {string} [color] - Color of the debug info to be rendered (format is css color string). - * @param {boolean} [fill=false] - If false the bounds outline is rendered, if true the whole rectangle is rendered. - */ - renderSpriteBounds: function (sprite, color, fill) { - - if (this.context == null) - { - return; - } - - color = color || 'rgb(255,0,255)'; - - if (typeof fill === 'undefined') { fill = false; } - - this.start(0, 0, color); - - if (fill) - { - this.context.fillStyle = color; - this.context.fillRect(sprite.bounds.x, sprite.bounds.y, sprite.bounds.width, sprite.bounds.height); - } - else - { - this.context.strokeStyle = color; - this.context.strokeRect(sprite.bounds.x, sprite.bounds.y, sprite.bounds.width, sprite.bounds.height); - this.context.stroke(); - } - - this.stop(); - - }, - /** * Renders a single pixel. * @method Phaser.Utils.Debug#renderPixel @@ -1278,9 +1129,35 @@ Phaser.Utils.Debug.prototype = { }, + /** + * Render Sprite Body Physics Data as text. + * @method Phaser.Utils.Debug#renderBodyInfo + * @param {Phaser.Sprite} sprite - The sprite to be rendered. + * @param {number} x - X position of the debug info to be rendered. + * @param {number} y - Y position of the debug info to be rendered. + * @param {string} [color='rgb(255,255,255)'] - color of the debug info to be rendered. (format is css color string). + */ + renderBodyInfo: function (sprite, x, y, color) { + + color = color || 'rgb(255,255,255)'; + + this.start(x, y, color, 210); + + this.splitline('x: ' + sprite.body.x.toFixed(2), 'y: ' + sprite.body.y.toFixed(2), 'width: ' + sprite.width, 'height: ' + sprite.height); + // this.splitline('speed: ' + sprite.body.speed.toFixed(2), 'angle: ' + sprite.body.angle.toFixed(2), 'linear damping: ' + sprite.body.linearDamping); + // this.splitline('blocked left: ' + sprite.body.blocked.left, 'right: ' + sprite.body.blocked.right, 'up: ' + sprite.body.blocked.up, 'down: ' + sprite.body.blocked.down); + // this.splitline('touching left: ' + sprite.body.touching.left, 'right: ' + sprite.body.touching.right, 'up: ' + sprite.body.touching.up, 'down: ' + sprite.body.touching.down); + // this.splitline('gravity x: ' + sprite.body.gravity.x, 'y: ' + sprite.body.gravity.y, 'world gravity x: ' + this.game.physics.gravity.x, 'y: ' + this.game.physics.gravity.y); + // this.splitline('acceleration x: ' + sprite.body.acceleration.x.toFixed(2), 'y: ' + sprite.body.acceleration.y.toFixed(2)); + // this.splitline('velocity x: ' + sprite.body.velocity.x.toFixed(2), 'y: ' + sprite.body.velocity.y.toFixed(2), 'deltaX: ' + sprite.body.deltaX().toFixed(2), 'deltaY: ' + sprite.body.deltaY().toFixed(2)); + // this.splitline('bounce x: ' + sprite.body.bounce.x.toFixed(2), 'y: ' + sprite.body.bounce.y.toFixed(2)); + this.stop(); + + }, + /** * @method Phaser.Utils.Debug#renderPhysicsBody - * @param {array} body + * @param {Phaser.Body} body - The Phaser.Body instance to render all shapes from. * @param {string} [color='rgb(255,255,255)'] - The color the polygon is stroked in. */ renderPhysicsBody: function (body, color, context) { @@ -1292,91 +1169,118 @@ Phaser.Utils.Debug.prototype = { color = color || 'rgb(255,255,255)'; - var x = body.x - this.game.camera.x; - var y = body.y - this.game.camera.y; + this.start(0, 0, color); - if (body.type === Phaser.Physics.Arcade.CIRCLE) + var shapes = body.data.shapes; + var shapeOffsets = body.data.shapeOffsets; + var shapeAngles = body.data.shapeAngles; + + var i = shapes.length; + var x = this.game.math.p2px(body.data.position[0]) - this.game.camera.view.x; + var y = this.game.math.p2px(body.data.position[1]) - this.game.camera.view.y; + var angle = body.data.angle; + + while (i--) { - this.start(0, 0, color); - this.context.beginPath(); - this.context.strokeStyle = color; - this.context.arc(x, y, body.shape.r, 0, Math.PI * 2, false); - this.context.stroke(); - this.context.closePath(); - - // this.context.strokeStyle = 'rgb(0,0,255)'; - // this.context.strokeRect(body.left, body.top, body.width, body.height); - - this.stop(); - } - else - { - var points = body.polygon.points; - - this.start(0, 0, color); - - this.context.beginPath(); - this.context.moveTo(x + points[0].x, y + points[0].y); - - for (var i = 1; i < points.length; i++) + if (shapes[i] instanceof p2.Rectangle) { - this.context.lineTo(x + points[i].x, y + points[i].y); + this.renderShapeRectangle(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]); } - - this.context.closePath(); - this.context.strokeStyle = color; - this.context.stroke(); - - this.context.fillStyle = 'rgb(255,0,0)'; - this.context.fillRect(x + points[0].x - 2, y + points[0].y - 2, 5, 5); - - for (var i = 1; i < points.length; i++) + else if (shapes[i] instanceof p2.Line) { - this.context.fillStyle = 'rgb(255,' + (i * 40) + ',0)'; - this.context.fillRect(x + points[i].x - 2, y + points[i].y - 2, 5, 5); + this.renderShapeLine(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]); + } + // else if (shapes[i] instanceof p2.Convex) + else + { + this.renderShapeConvex(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]); } - - // this.context.strokeStyle = 'rgb(0,255,255)'; - // this.context.strokeRect(body.left, body.top, body.width, body.height); - - this.stop(); } + this.stop(); + }, /** - * @method Phaser.Utils.Debug#renderPolygon - * @param {array} polygon - * @param {string} [color='rgb(255,255,255)'] - The color the polygon is stroked in. + * @method Phaser.Utils.Debug#renderShape + * @param {p2.Shape} shape - The shape to render. + * @param {number} x - The x coordinate of the Body to translate to. + * @param {number} y - The y coordinate of the Body to translate to. + * @param {number} angle - The angle of the Body to rotate to. */ - renderPolygon: function (polygon, color, context) { - - if (this.context === null && context === null) - { - return; - } - - color = color || 'rgb(255,255,255)'; - - var points = polygon.points; - var x = polygon.pos.x; - var y = polygon.pos.y; - - this.start(0, 0, color); + renderShapeRectangle: function (x, y, bodyAngle, shape, offset, angle) { + + var w = this.game.math.p2px(shape.width); + var h = this.game.math.p2px(shape.height); + var points = shape.vertices; this.context.beginPath(); - this.context.moveTo(x + points[0].x, y + points[0].y); + this.context.save(); + this.context.translate(x + this.game.math.p2px(offset[0]), y + this.game.math.p2px(offset[1])); + this.context.rotate(bodyAngle + angle); + + this.context.moveTo(this.game.math.p2px(points[0][0]), this.game.math.p2px(points[0][1])); for (var i = 1; i < points.length; i++) { - this.context.lineTo(x + points[i].x, y + points[i].y); + this.context.lineTo(this.game.math.p2px(points[i][0]), this.game.math.p2px(points[i][1])); } this.context.closePath(); - this.context.strokeStyle = color; this.context.stroke(); + this.context.restore(); - this.stop(); + }, + + /** + * @method Phaser.Utils.Debug#renderShape + * @param {number} x - The x coordinate of the Body to translate to. + * @param {number} y - The y coordinate of the Body to translate to. + * @param {p2.Shape} shape - The shape to render. + * @param {number} offset - + * @param {number} angle - + */ + renderShapeLine: function (x, y, bodyAngle, shape, offset, angle) { + + this.context.beginPath(); + this.context.save(); + this.context.translate(x, y); + this.context.rotate(bodyAngle + angle); + this.context.lineWidth = 0.5; + this.context.moveTo(0, 0); + this.context.lineTo(this.game.math.p2px(shape.length), 0); + this.context.closePath(); + this.context.stroke(); + this.context.restore(); + + }, + + /** + * @method Phaser.Utils.Debug#renderShape + * @param {p2.Shape} shape - The shape to render. + * @param {number} x - The x coordinate of the Body to translate to. + * @param {number} y - The y coordinate of the Body to translate to. + * @param {number} angle - The angle of the Body to rotate to. + */ + renderShapeConvex: function (x, y, bodyAngle, shape, offset, angle) { + + var points = shape.vertices; + + this.context.beginPath(); + this.context.save(); + this.context.translate(x + this.game.math.p2px(offset[0]), y + this.game.math.p2px(offset[1])); + this.context.rotate(bodyAngle + angle); + + this.context.moveTo(this.game.math.p2px(points[0][0]), this.game.math.p2px(points[0][1])); + + for (var i = 1; i < points.length; i++) + { + this.context.lineTo(this.game.math.p2px(points[i][0]), this.game.math.p2px(points[i][1])); + } + + this.context.closePath(); + this.context.stroke(); + this.context.restore(); } @@ -1404,7 +1308,7 @@ Phaser.Utils.Debug.prototype.constructor = Phaser.Utils.Debug; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Device.js.html b/docs/Device.js.html index f7d283ec..5687538f 100644 --- a/docs/Device.js.html +++ b/docs/Device.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -640,7 +648,7 @@ Phaser.Device = function () { this.ie = false; /** - * @property {number} ieVersion - If running in Internet Explorer this will contain the major version number. + * @property {number} ieVersion - If running in Internet Explorer this will contain the major version number. Beyond IE10 you should use Device.trident and Device.tridentVersion. * @default */ this.ieVersion = 0; @@ -925,11 +933,12 @@ Phaser.Device.prototype = { { this.silk = true; } - else if (/Trident\/(\d+\.\d+);/.test(ua)) + else if (/Trident\/(\d+\.\d+); rv:(\d+\.\d+)/.test(ua)) { this.ie = true; this.trident = true; this.tridentVersion = parseInt(RegExp.$1, 10); + this.ieVersion = parseInt(RegExp.$2, 10); } // WebApp mode in iOS @@ -1149,7 +1158,7 @@ Phaser.Device.prototype.constructor = Phaser.Device; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Easing.js.html b/docs/Easing.js.html index 16d187ee..a85b1cd4 100644 --- a/docs/Easing.js.html +++ b/docs/Easing.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1033,7 +1041,7 @@ Phaser.Easing = { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Ellipse.js.html b/docs/Ellipse.js.html new file mode 100644 index 00000000..24b866c0 --- /dev/null +++ b/docs/Ellipse.js.html @@ -0,0 +1,817 @@ + + + + + + Phaser Source: geom/Ellipse.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: geom/Ellipse.js

    + +
    +
    +
    /**
    +* @author       Richard Davey <rich@photonstorm.com>
    +* @author       Chad Engler <chad@pantherdev.com>
    +* @copyright    2014 Photon Storm Ltd.
    +* @license      {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
    +*/
    +
    +/**
    +* Creates a Ellipse object. A curve on a plane surrounding two focal points.
    +* @class Ellipse
    +* @classdesc Phaser - Ellipse
    +* @constructor
    +* @param {number} [x=0] - The X coordinate of the upper-left corner of the framing rectangle of this ellipse.
    +* @param {number} [y=0] - The Y coordinate of the upper-left corner of the framing rectangle of this ellipse.
    +* @param {number} [width=0] - The overall width of this ellipse.
    +* @param {number} [height=0] - The overall height of this ellipse.
    +* @return {Phaser.Ellipse} This Ellipse object
    +*/
    +Phaser.Ellipse = function (x, y, width, height) {
    +
    +    this.type = Phaser.ELLIPSE;
    +
    +    x = x || 0;
    +    y = y || 0;
    +    width = width || 0;
    +    height = height || 0;
    +
    +    /**
    +    * @property {number} x - The X coordinate of the upper-left corner of the framing rectangle of this ellipse.
    +    */
    +    this.x = x;
    +
    +    /**
    +    * @property {number} y - The Y coordinate of the upper-left corner of the framing rectangle of this ellipse.
    +    */
    +    this.y = y;
    +
    +    /**
    +    * @property {number} width - The overall width of this ellipse.
    +    */
    +    this.width = width;
    +
    +    /**
    +    * @property {number} height - The overall height of this ellipse.
    +    */
    +    this.height = height;
    +
    +};
    +
    +Phaser.Ellipse.prototype = {
    +
    +    /**
    +    * Sets the members of the Ellipse to the specified values.
    +    * @method Phaser.Ellipse#setTo
    +    * @param {number} x - The X coordinate of the upper-left corner of the framing rectangle of this ellipse.
    +    * @param {number} y - The Y coordinate of the upper-left corner of the framing rectangle of this ellipse.
    +    * @param {number} width - The overall width of this ellipse.
    +    * @param {number} height - The overall height of this ellipse.
    +    * @return {Phaser.Ellipse} This Ellipse object.
    +    */
    +    setTo: function (x, y, width, height) {
    +
    +        this.x = x;
    +        this.y = y;
    +        this.width = width;
    +        this.height = height;
    +
    +        return this;
    +
    +    },
    +
    +    /**
    +    * Copies the x, y, width and height properties from any given object to this Ellipse.
    +    * @method Phaser.Ellipse#copyFrom
    +    * @param {any} source - The object to copy from.
    +    * @return {Phaser.Ellipse} This Ellipse object.
    +    */
    +    copyFrom: function (source) {
    +
    +        return this.setTo(source.x, source.y, source.width, source.height);
    +
    +    },
    +
    +    /**
    +    * Copies the x, y and diameter properties from this Circle to any given object.
    +    * @method Phaser.Ellipse#copyTo
    +    * @param {any} dest - The object to copy to.
    +    * @return {Object} This dest object.
    +    */
    +    copyTo: function(dest) {
    +
    +        dest.x = this.x;
    +        dest.y = this.y;
    +        dest.width = this.width;
    +        dest.height = this.height;
    +
    +        return dest;
    +
    +    },
    +
    +    /**
    +    * Returns a new Ellipse object with the same values for the x, y, width, and height properties as this Ellipse object.
    +    * @method Phaser.Ellipse#clone
    +    * @param {Phaser.Ellipse} out - Optional Ellipse object. If given the values will be set into the object, otherwise a brand new Ellipse object will be created and returned.
    +    * @return {Phaser.Ellipse} The cloned Ellipse object.
    +    */
    +    clone: function(out) {
    +
    +        if (typeof out === "undefined")
    +        {
    +            out = new Phaser.Ellipse(this.x, this.y, this.width, this.height);
    +        }
    +        else
    +        {
    +            out.setTo(this.x, this.y, this.width, this.height);
    +        }
    +
    +        return out;
    +
    +    },
    +
    +    /**
    +    * Return true if the given x/y coordinates are within this Ellipse object.
    +    * @method Phaser.Ellipse#contains
    +    * @param {number} x - The X value of the coordinate to test.
    +    * @param {number} y - The Y value of the coordinate to test.
    +    * @return {boolean} True if the coordinates are within this ellipse, otherwise false.
    +    */
    +    contains: function (x, y) {
    +
    +        return Phaser.Ellipse.contains(this, x, y);
    +
    +    },
    +
    +    /**
    +    * Returns a string representation of this object.
    +    * @method Phaser.Ellipse#toString
    +    * @return {string} A string representation of the instance.
    +    */
    +    toString: function () {
    +        return "[{Phaser.Ellipse (x=" + this.x + " y=" + this.y + " width=" + this.width + " height=" + this.height + ")}]";
    +    }
    +
    +};
    +
    +Phaser.Ellipse.prototype.constructor = Phaser.Ellipse;
    +
    +/**
    +* The left coordinate of the Ellipse. The same as the X coordinate.
    +* @name Phaser.Ellipse#left
    +* @propety {number} left - Gets or sets the value of the leftmost point of the ellipse.
    +*/
    +Object.defineProperty(Phaser.Ellipse.prototype, "left", {
    +    
    +    get: function () {
    +        return this.x;
    +    },
    +
    +    set: function (value) {
    +
    +        this.x = value;
    +
    +    }
    +
    +});
    +
    +/**
    +* The x coordinate of the rightmost point of the Ellipse. Changing the right property of an Ellipse object has no effect on the x property, but does adjust the width.
    +* @name Phaser.Ellipse#right
    +* @property {number} right - Gets or sets the value of the rightmost point of the ellipse.
    +*/
    +Object.defineProperty(Phaser.Ellipse.prototype, "right", {
    +
    +    get: function () {
    +        return this.x + this.width;
    +    },
    +
    +    set: function (value) {
    +
    +        if (value < this.x)
    +        {
    +            this.width = 0;
    +        }
    +        else
    +        {
    +            this.width = this.x + width;
    +        }
    +    }
    +
    +});
    +
    +/**
    +* The top of the Ellipse. The same as its y property.
    +* @name Phaser.Ellipse#top
    +* @property {number} top - Gets or sets the top of the ellipse.
    +*/
    +Object.defineProperty(Phaser.Ellipse.prototype, "top", {
    +
    +    get: function () {
    +        return this.y;
    +    },
    +    
    +    set: function (value) {
    +        this.y = value;
    +    }
    +
    +});
    +
    +/**
    +* The sum of the y and height properties. Changing the bottom property of an Ellipse doesn't adjust the y property, but does change the height.
    +* @name Phaser.Ellipse#bottom
    +* @property {number} bottom - Gets or sets the bottom of the ellipse.
    +*/
    +Object.defineProperty(Phaser.Ellipse.prototype, "bottom", {
    +
    +    get: function () {
    +        return this.y + this.height;
    +    },
    +
    +    set: function (value) {
    +
    +        if (value < this.y)
    +        {
    +            this.height = 0;
    +        }
    +        else
    +        {
    +            this.height = this.y + value;
    +        }
    +    }
    +
    +});
    +
    +/**
    +* Determines whether or not this Ellipse object is empty. Will return a value of true if the Ellipse objects dimensions are less than or equal to 0; otherwise false.
    +* If set to true it will reset all of the Ellipse objects properties to 0. An Ellipse object is empty if its width or height is less than or equal to 0.
    +* @name Phaser.Ellipse#empty
    +* @property {boolean} empty - Gets or sets the empty state of the ellipse.
    +*/
    +Object.defineProperty(Phaser.Ellipse.prototype, "empty", {
    +
    +    get: function () {
    +        return (this.width === 0 || this.height === 0);
    +    },
    +
    +    set: function (value) {
    +
    +        if (value === true)
    +        {
    +            this.setTo(0, 0, 0, 0);
    +        }
    +
    +    }
    +
    +});
    +
    +/**
    +* Return true if the given x/y coordinates are within the Ellipse object.
    +* @method Phaser.Ellipse.contains
    +* @param {Phaser.Ellipse} a - The Ellipse to be checked.
    +* @param {number} x - The X value of the coordinate to test.
    +* @param {number} y - The Y value of the coordinate to test.
    +* @return {boolean} True if the coordinates are within this ellipse, otherwise false.
    +*/
    +Phaser.Ellipse.contains = function (a, x, y) {
    +
    +    if (a.width <= 0 || a.height <= 0)
    +    {
    +        return false;
    +    }
    +
    +    //  Normalize the coords to an ellipse with center 0,0 and a radius of 0.5
    +    var normx = ((x - a.x) / a.width) - 0.5;
    +    var normy = ((y - a.y) / a.height) - 0.5;
    +
    +    normx *= normx;
    +    normy *= normy;
    +
    +    return (normx + normy < 0.25);
    +
    +};
    +
    +/**
    +* Returns the framing rectangle of the ellipse as a Phaser.Rectangle object.
    +*
    +* @method getBounds
    +* @return {Phaser.Rectangle} The framing rectangle
    +*/
    +Phaser.Ellipse.prototype.getBounds = function() {
    +
    +    return new Phaser.Rectangle(this.x, this.y, this.width, this.height);
    +
    +};
    +
    +//   Because PIXI uses its own Ellipse, we'll replace it with ours to avoid duplicating code or confusion.
    +PIXI.Ellipse = Phaser.Ellipse;
    +
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2014 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.3.0-dev + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/docs/Emitter.js.html b/docs/Emitter.js.html index ee21431b..0e66e7e7 100644 --- a/docs/Emitter.js.html +++ b/docs/Emitter.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1104,7 +1112,7 @@ Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype, "bottom", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Events.js.html b/docs/Events.js.html index b4e01086..b9041966 100644 --- a/docs/Events.js.html +++ b/docs/Events.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -493,9 +501,6 @@ Phaser.Events = function (sprite) { this.onAnimationComplete = null; this.onAnimationLoop = null; - this.onBeginContact = null; - this.onEndContact = null; - }; Phaser.Events.prototype = { @@ -552,7 +557,7 @@ Phaser.Events.prototype.constructor = Phaser.Events; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Filter.js.html b/docs/Filter.js.html index 1fd36302..ec74b2fc 100644 --- a/docs/Filter.js.html +++ b/docs/Filter.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -486,6 +494,12 @@ Phaser.Filter = function (game, uniforms, fragmentSrc) { */ this.passes = [this]; + /** + * @property {array} shaders - Array an array of shaders. + * @private + */ + this.shaders = []; + /** * @property {boolean} dirty - Internal PIXI var. * @default @@ -629,7 +643,7 @@ Object.defineProperty(Phaser.Filter.prototype, 'height', { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Frame.js.html b/docs/Frame.js.html index f72b2198..8326f03d 100644 --- a/docs/Frame.js.html +++ b/docs/Frame.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -654,7 +662,7 @@ Phaser.Frame.prototype.constructor = Phaser.Frame; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/FrameData.js.html b/docs/FrameData.js.html index 2ab0c7e5..293cd777 100644 --- a/docs/FrameData.js.html +++ b/docs/FrameData.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -709,7 +717,7 @@ Object.defineProperty(Phaser.FrameData.prototype, "total", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Game.js.html b/docs/Game.js.html index 93add7bd..5cd5031c 100644 --- a/docs/Game.js.html +++ b/docs/Game.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -559,13 +567,11 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant /** * @property {Phaser.RequestAnimationFrame} raf - Automatically handles the core game loop via requestAnimationFrame or setTimeout - * @default */ this.raf = null; /** * @property {Phaser.GameObjectFactory} add - Reference to the GameObject Factory. - * @default */ this.add = null; @@ -589,91 +595,81 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant /** * @property {Phaser.Math} math - Reference to the math helper. - * @default */ this.math = null; /** * @property {Phaser.Net} net - Reference to the network class. - * @default */ this.net = null; + /** + * @property {Phaser.StageScaleMode} scale - The game scale manager. + */ + this.scale = null; + /** * @property {Phaser.SoundManager} sound - Reference to the sound manager. - * @default */ this.sound = null; /** * @property {Phaser.Stage} stage - Reference to the stage. - * @default */ this.stage = null; /** * @property {Phaser.TimeManager} time - Reference to game clock. - * @default */ this.time = null; /** * @property {Phaser.TweenManager} tweens - Reference to the tween manager. - * @default */ this.tweens = null; /** * @property {Phaser.World} world - Reference to the world. - * @default */ this.world = null; /** - * @property {Phaser.Physics.PhysicsManager} physics - Reference to the physics manager. - * @default + * @property {Phaser.Physics.World} physics - Reference to the physics world. */ this.physics = null; /** * @property {Phaser.RandomDataGenerator} rnd - Instance of repeatable random data generator helper. - * @default */ this.rnd = null; /** * @property {Phaser.Device} device - Contains device information and capabilities. - * @default */ this.device = null; /** * @property {Phaser.Physics.PhysicsManager} camera - A handy reference to world.camera. - * @default */ this.camera = null; - /** - * @property {HTMLCanvasElement} canvas - A handy reference to renderer.view. - * @default + /** + * @property {HTMLCanvasElement} canvas - A handy reference to renderer.view, the canvas that the game is being rendered in to. */ this.canvas = null; /** - * @property {Context} context - A handy reference to renderer.context (only set for CANVAS games) - * @default + * @property {Context} context - A handy reference to renderer.context (only set for CANVAS games, not WebGL) */ this.context = null; /** * @property {Phaser.Utils.Debug} debug - A set of useful debug utilitie. - * @default */ this.debug = null; /** * @property {Phaser.Particles} particles - The Particle Manager. - * @default */ this.particles = null; @@ -886,6 +882,7 @@ Phaser.Game.prototype = { this.rnd = new Phaser.RandomDataGenerator([(Date.now() * Math.random()).toString()]); this.stage = new Phaser.Stage(this, this.width, this.height); + this.scale = new Phaser.StageScaleMode(this, this.width, this.height); this.setUpRenderer(); @@ -897,7 +894,7 @@ Phaser.Game.prototype = { this.tweens = new Phaser.TweenManager(this); this.input = new Phaser.Input(this); this.sound = new Phaser.SoundManager(this); - this.physics = new Phaser.Physics.Arcade(this); + this.physics = new Phaser.Physics.World(this); this.particles = new Phaser.Particles(this); this.plugins = new Phaser.PluginManager(this, this); this.net = new Phaser.Net(this); @@ -994,9 +991,9 @@ Phaser.Game.prototype = { this.renderType = Phaser.CANVAS; } - this.renderer = new PIXI.CanvasRenderer(this.width, this.height, this.stage.canvas, this.transparent); + this.renderer = new PIXI.CanvasRenderer(this.width, this.height, this.canvas, this.transparent); Phaser.Canvas.setSmoothingEnabled(this.renderer.context, this.antialias); - this.canvas = this.renderer.view; + // this.canvas = this.renderer.view; this.context = this.renderer.context; } else @@ -1008,13 +1005,16 @@ Phaser.Game.prototype = { { // They requested WebGL, and their browser supports it this.renderType = Phaser.WEBGL; - this.renderer = new PIXI.WebGLRenderer(this.width, this.height, this.stage.canvas, this.transparent, this.antialias); - this.canvas = this.renderer.view; + this.renderer = new PIXI.WebGLRenderer(this.width, this.height, this.canvas, this.transparent, this.antialias); + // this.canvas = this.renderer.view; this.context = null; } - Phaser.Canvas.addToDOM(this.renderer.view, this.parent, true); - Phaser.Canvas.setTouchAction(this.renderer.view); + // Phaser.Canvas.addToDOM(this.renderer.view, this.parent, true); + // Phaser.Canvas.setTouchAction(this.renderer.view); + + Phaser.Canvas.addToDOM(this.canvas, this.parent, true); + Phaser.Canvas.setTouchAction(this.canvas); }, @@ -1045,7 +1045,7 @@ Phaser.Game.prototype = { if (this._paused) { - this.renderer.render(this.stage._stage); + this.renderer.render(this.stage); this.plugins.render(); this.state.render(); } @@ -1059,24 +1059,24 @@ Phaser.Game.prototype = { } this.plugins.preUpdate(); - this.world.preUpdate(); + this.stage.preUpdate(); this.stage.update(); this.tweens.update(); this.sound.update(); this.input.update(); this.state.update(); - this.world.update(); + this.physics.update(); this.particles.update(); this.plugins.update(); - this.world.postUpdate(); + this.stage.postUpdate(); this.plugins.postUpdate(); } if (this.renderType !== Phaser.HEADLESS) { - this.renderer.render(this.stage._stage); + this.renderer.render(this.stage); this.plugins.render(); this.state.render(); @@ -1213,7 +1213,7 @@ Object.defineProperty(Phaser.Game.prototype, "paused", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/GameObjectFactory.js.html b/docs/GameObjectFactory.js.html index e401b29f..37e6e171 100644 --- a/docs/GameObjectFactory.js.html +++ b/docs/GameObjectFactory.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -548,11 +556,33 @@ Phaser.GameObjectFactory.prototype = { * @method Phaser.GameObjectFactory#group * @param {any} parent - The parent Group or DisplayObjectContainer that will hold this group, if any. * @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging. + * @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World. * @return {Phaser.Group} The newly created group. */ - group: function (parent, name) { + group: function (parent, name, addToStage) { - return new Phaser.Group(this.game, parent, name); + if (typeof name === 'undefined') { name = 'group'; } + if (typeof addToStage === 'undefined') { addToStage = false; } + + return new Phaser.Group(this.game, parent, name, addToStage); + + }, + + /** + * A Group is a container for display objects that allows for fast pooling, recycling and collision checks. + * + * @method Phaser.GameObjectFactory#spriteBatch + * @param {any} parent - The parent Group or DisplayObjectContainer that will hold this group, if any. + * @param {string} [name='group'] - A name for this Group. Not used internally but useful for debugging. + * @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World. + * @return {Phaser.Group} The newly created group. + */ + spriteBatch: function (parent, name, addToStage) { + + if (typeof name === 'undefined') { name = 'group'; } + if (typeof addToStage === 'undefined') { addToStage = false; } + + return new Phaser.SpriteBatch(this.game, parent, name, addToStage); }, @@ -592,19 +622,20 @@ Phaser.GameObjectFactory.prototype = { * Creates a new TileSprite object. * * @method Phaser.GameObjectFactory#tileSprite - * @param {number} x - X position of the new tileSprite. - * @param {number} y - Y position of the new tileSprite. - * @param {number} width - the width of the tilesprite. - * @param {number} height - the height of the tilesprite. - * @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture. + * @param {number} x - The x coordinate (in world space) to position the TileSprite at. + * @param {number} y - The y coordinate (in world space) to position the TileSprite at. + * @param {number} width - The width of the TileSprite. + * @param {number} height - The height of the TileSprite. + * @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the TileSprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture. + * @param {string|number} frame - If this TileSprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index. * @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group. * @return {Phaser.TileSprite} The newly created tileSprite object. */ - tileSprite: function (x, y, width, height, key, group) { + tileSprite: function (x, y, width, height, key, frame, group) { if (typeof group === 'undefined') { group = this.world; } - return group.add(new Phaser.TileSprite(this.game, x, y, width, height, key)); + return group.add(new Phaser.TileSprite(this.game, x, y, width, height, key, frame)); }, @@ -686,21 +717,45 @@ Phaser.GameObjectFactory.prototype = { }, /** - * * Create a new BitmapText object. + * Create a new BitmapFont object to be used as a texture for an Image or Sprite and optionally add it to the Cache. + * The texture can be asssigned or one or multiple images/sprites, but note that the text the BitmapFont uses will be shared across them all, + * i.e. if you need each Image to have different text in it, then you need to create multiple BitmapFont objects. + * + * @method Phaser.GameObjectFactory#bitmapFont + * @param {string} font - The key of the image in the Game.Cache that the BitmapFont will use. + * @param {number} characterWidth - The width of each character in the font set. + * @param {number} characterHeight - The height of each character in the font set. + * @param {string} chars - The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements. + * @param {number} charsPerRow - The number of characters per row in the font set. + * @param {number} [xSpacing=0] - If the characters in the font set have horizontal spacing between them set the required amount here. + * @param {number} [ySpacing=0] - If the characters in the font set have vertical spacing between them set the required amount here. + * @param {number} [xOffset=0] - If the font set doesn't start at the top left of the given image, specify the X coordinate offset here. + * @param {number} [yOffset=0] - If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here. + * @return {Phaser.BitmapFont} The newly created BitmapFont texture which can be applied to an Image or Sprite. + */ + bitmapFont: function (font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset) { + + return new Phaser.BitmapFont(this.game, font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset); + + }, + + /** + * Create a new BitmapText object. * * @method Phaser.GameObjectFactory#bitmapText * @param {number} x - X position of the new bitmapText object. * @param {number} y - Y position of the new bitmapText object. - * @param {string} text - The actual text that will be written. - * @param {object} style - The style object containing style attributes like font, font size , etc. + * @param {string} font - The key of the BitmapText font as stored in Game.Cache. + * @param {string} [text] - The actual text that will be rendered. Can be set later via BitmapText.text. + * @param {number} [size] - The size the font will be rendered in, in pixels. * @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group. * @return {Phaser.BitmapText} The newly created bitmapText object. */ - bitmapText: function (x, y, text, style, group) { + bitmapText: function (x, y, font, text, size, group) { if (typeof group === 'undefined') { group = this.world; } - return this.world.add(new Phaser.BitmapText(this.game, x, y, text, style)); + return group.add(new Phaser.BitmapText(this.game, x, y, font, text, size)); }, @@ -730,8 +785,8 @@ Phaser.GameObjectFactory.prototype = { */ renderTexture: function (width, height, key, addToCache) { - if (typeof addToCache === 'undefined') { addToCache = false; } if (typeof key === 'undefined' || key === '') { key = this.game.rnd.uuid(); } + if (typeof addToCache === 'undefined') { addToCache = false; } var texture = new Phaser.RenderTexture(this.game, width, height, key); @@ -814,7 +869,7 @@ Phaser.GameObjectFactory.prototype.constructor = Phaser.GameObjectFactory; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Gamepad.js.html b/docs/Gamepad.js.html index 245e1a69..8922f0e0 100644 --- a/docs/Gamepad.js.html +++ b/docs/Gamepad.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1048,7 +1056,7 @@ Phaser.Gamepad.XBOX360_STICK_RIGHT_Y = 3; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/GamepadButton.js.html b/docs/GamepadButton.js.html index 55529636..e290fc91 100644 --- a/docs/GamepadButton.js.html +++ b/docs/GamepadButton.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -645,7 +653,7 @@ Phaser.GamepadButton.prototype.constructor = Phaser.GamepadButton; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Graphics.js.html b/docs/Graphics.js.html index 02ec9f9b..c5f5afb0 100644 --- a/docs/Graphics.js.html +++ b/docs/Graphics.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -467,23 +475,124 @@ */ Phaser.Graphics = function (game, x, y) { + x = x || 0; + y = y || 0; + + /** + * @property {Phaser.Game} game - A reference to the currently running Game. + */ this.game = game; + + /** + * @property {boolean} exists - If exists = false then the Text isn't updated by the core game loop. + * @default + */ + this.exists = true; + + /** + * @property {string} name - The user defined name given to this object. + * @default + */ + this.name = ''; + + /** + * @property {number} type - The const type of this object. + * @default + */ + this.type = Phaser.GRAPHICS; + + /** + * @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); + + /** + * @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view. + */ + this.cameraOffset = new Phaser.Point(); PIXI.Graphics.call(this); - /** - * @property {number} type - The Phaser Object Type. - */ - this.type = Phaser.GRAPHICS; + this.position.set(x, y); - this.position.x = x; - this.position.y = y; + /** + * A small internal cache: + * 0 = previous position.x + * 1 = previous position.y + * 2 = previous rotation + * 3 = renderID + * 4 = fresh? (0 = no, 1 = yes) + * 5 = outOfBoundsFired (0 = no, 1 = yes) + * 6 = exists (0 = no, 1 = yes) + * 7 = fixed to camera (0 = no, 1 = yes) + * @property {Int16Array} _cache + * @private + */ + this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0]); }; Phaser.Graphics.prototype = Object.create(PIXI.Graphics.prototype); Phaser.Graphics.prototype.constructor = Phaser.Graphics; +/** +* Automatically called by World.preUpdate. +* @method Phaser.Graphics.prototype.preUpdate +*/ +Phaser.Graphics.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; + +} + +/** +* Override and use this function in your own custom objects to handle any update requirements you may have. +* +* @method Phaser.Graphics#update +* @memberof Phaser.Graphics +*/ +Phaser.Graphics.prototype.update = function() { + +} + +/** +* Automatically called by World.postUpdate. +* @method Phaser.Graphics.prototype.postUpdate +*/ +Phaser.Graphics.prototype.postUpdate = function () { + + // Fixed to Camera? + if (this._cache[7] === 1) + { + this.position.x = this.game.camera.view.x + this.cameraOffset.x; + this.position.y = this.game.camera.view.y + this.cameraOffset.y; + } + +} + /** * Destroy this Graphics instance. * @@ -498,6 +607,9 @@ Phaser.Graphics.prototype.destroy = function() { this.parent.remove(this); } + this.exists = false; + this.visible = false; + this.game = null; } @@ -521,13 +633,54 @@ Phaser.Graphics.prototype.drawPolygon = function (poly) { } /** -* 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. +* Indicates the rotation of the Graphics, 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. +* If you wish to work in radians instead of degrees use the property Sprite.rotation instead. +* @name Phaser.Graphics#angle +* @property {number} angle - Gets or sets the angle of rotation in degrees. */ +Object.defineProperty(Phaser.Graphics.prototype, 'angle', { + + get: function() { + return Phaser.Math.radToDeg(this.rotation); + }, + + set: function(value) { + this.rotation = Phaser.Math.degToRad(value); + } + +}); + +/** +* An Graphics that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Graphics.cameraOffset. +* Note that the cameraOffset values are in addition to any parent in the display list. +* So if this Graphics was in a Group that has x: 200, then this will be added to the cameraOffset.x +* +* @name Phaser.Graphics#fixedToCamera +* @property {boolean} fixedToCamera - Set to true to fix this Graphics to the Camera at its current world coordinates. +*/ +Object.defineProperty(Phaser.Graphics.prototype, "fixedToCamera", { + + get: function () { + + return !!this._cache[7]; + + }, + + set: function (value) { + + if (value) + { + this._cache[7] = 1; + this.cameraOffset.set(this.x, this.y); + } + else + { + this._cache[7] = 0; + } + } + +}); @@ -549,7 +702,7 @@ Phaser.Graphics.prototype.drawPolygon = function (poly) { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Group.js.html b/docs/Group.js.html index 48a7a8ed..f2d16f2c 100644 --- a/docs/Group.js.html +++ b/docs/Group.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -458,14 +466,14 @@ /** * Phaser Group constructor. * @class Phaser.Group -* @classdesc A Group is a container for display objects that allows for fast pooling, recycling and collision checks. +* @classdesc A Group is a container for display objects that allows for fast pooling and object recycling. Groups can be nested within other Groups and have their own local transforms. * @constructor * @param {Phaser.Game} game - A reference to the currently running game. -* @param {*} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined or null it will use game.world. +* @param {Phaser.Group|Phaser.Sprite} 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 this Group be added to the World (default, false) or direct to the Stage (true). +* @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World. */ -Phaser.Group = function (game, parent, name, useStage) { +Phaser.Group = function (game, parent, name, addToStage) { /** * @property {Phaser.Game} game - A reference to the currently running Game. @@ -484,7 +492,7 @@ Phaser.Group = function (game, parent, name, useStage) { PIXI.DisplayObjectContainer.call(this); - if (typeof useStage === 'undefined') + if (typeof addToStage === 'undefined' || addToStage === false) { if (parent) { @@ -492,12 +500,12 @@ Phaser.Group = function (game, parent, name, useStage) { } else { - this.game.stage._stage.addChild(this); + this.game.stage.addChild(this); } } else { - this.game.stage._stage.addChild(this); + this.game.stage.addChild(this); } /** @@ -521,7 +529,6 @@ Phaser.Group = function (game, parent, name, useStage) { /** * @property {Phaser.Group|Phaser.Sprite} parent - The parent of this Group. */ - // this.group = null; /** * @property {Phaser.Point} scale - The scale of the Group container. @@ -541,6 +548,26 @@ Phaser.Group = function (game, parent, name, useStage) { this._cursorIndex = 0; + /** + * @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view. + */ + this.cameraOffset = new Phaser.Point(); + + /** + * A small internal cache: + * 0 = previous position.x + * 1 = previous position.y + * 2 = previous rotation + * 3 = renderID + * 4 = fresh? (0 = no, 1 = yes) + * 5 = outOfBoundsFired (0 = no, 1 = yes) + * 6 = exists (0 = no, 1 = yes) + * 7 = fixed to camera (0 = no, 1 = yes) + * @property {Int16Array} _cache + * @private + */ + this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0]); + }; Phaser.Group.prototype = Object.create(PIXI.DisplayObjectContainer.prototype); @@ -576,8 +603,6 @@ Phaser.Group.SORT_ASCENDING = -1; */ Phaser.Group.SORT_DESCENDING = 1; -// 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 @@ -1155,6 +1180,69 @@ Phaser.Group.prototype.callAll = function (method, context) { } +/** +* The core preUpdate - as called by World. +* @method Phaser.Group#preUpdate +* @protected +*/ +Phaser.Group.prototype.preUpdate = function () { + + if (!this.exists || !this.parent.exists) + { + this.renderOrderID = -1; + return false; + } + + var i = this.children.length; + + while (i--) + { + this.children[i].preUpdate(); + } + + return true; + +} + +/** +* The core update - as called by World. +* @method Phaser.Group#update +* @protected +*/ +Phaser.Group.prototype.update = function () { + + var i = this.children.length; + + while (i--) + { + this.children[i].update(); + } + +} + +/** +* The core postUpdate - as called by World. +* @method Phaser.Group#postUpdate +* @protected +*/ +Phaser.Group.prototype.postUpdate = function () { + + // Fixed to Camera? + if (this._cache[7] === 1) + { + this.x = this.game.camera.view.x + this.cameraOffset.x; + this.y = this.game.camera.view.y + this.cameraOffset.y; + } + + var i = this.children.length; + + while (i--) + { + this.children[i].postUpdate(); + } + +} + /** * 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. @@ -1589,6 +1677,37 @@ Object.defineProperty(Phaser.Group.prototype, "angle", { }); +/** +* A Group that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Group.cameraOffset. +* Note that the cameraOffset values are in addition to any parent in the display list. +* So if this Group was in a Group that has x: 200, then this will be added to the cameraOffset.x +* +* @name Phaser.Group#fixedToCamera +* @property {boolean} fixedToCamera - Set to true to fix this Group to the Camera at its current world coordinates. +*/ +Object.defineProperty(Phaser.Group.prototype, "fixedToCamera", { + + get: function () { + + return !!this._cache[7]; + + }, + + set: function (value) { + + if (value) + { + this._cache[7] = 1; + this.cameraOffset.set(this.x, this.y); + } + else + { + this._cache[7] = 0; + } + } + +}); + // Documentation stubs /** @@ -1642,7 +1761,7 @@ Object.defineProperty(Phaser.Group.prototype, "angle", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Image.js.html b/docs/Image.js.html index 30345ec0..3cc169be 100644 --- a/docs/Image.js.html +++ b/docs/Image.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -481,13 +489,13 @@ Phaser.Image = function (game, x, y, key, frame) { 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. + * @property {boolean} exists - If exists = false then the Image isn't updated by the core game loop. * @default */ this.exists = true; /** - * @property {string} name - The user defined name given to this Sprite. + * @property {string} name - The user defined name given to this Image. * @default */ this.name = ''; @@ -499,16 +507,25 @@ Phaser.Image = function (game, x, y, key, frame) { 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. + * @property {Phaser.Events} events - The Events you can subscribe to that are dispatched when certain things happen on this Image 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. + * @property {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or 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. */ this.key = key; + /** + * @property {number} _frame - Internal cache var. + * @private + */ this._frame = 0; + + /** + * @property {string} _frameName - Internal cache var. + * @private + */ this._frameName = ''; PIXI.Sprite.call(this, PIXI.TextureCache['__default']); @@ -518,38 +535,44 @@ Phaser.Image = function (game, x, y, 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. + * @property {Phaser.Point} world - The world coordinates of this Image. This differs from the x/y coordinates which are relative to the Images container. */ this.world = new Phaser.Point(x, y); /** - * Should this Sprite be automatically culled if out of range of the camera? + * Should this Image 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. + * @property {boolean} autoCull - A flag indicating if the Image 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 + * @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view. + */ + this.cameraOffset = new Phaser.Point(); + + /** + * A small internal cache: + * 0 = previous position.x + * 1 = previous position.y + * 2 = previous rotation + * 3 = renderID + * 4 = fresh? (0 = no, 1 = yes) + * 5 = outOfBoundsFired (0 = no, 1 = yes) + * 6 = exists (0 = no, 1 = yes) + * 7 = fixed to camera (0 = no, 1 = yes) + * @property {Int16Array} _cache * @private */ - this._cache = [0, 0, 0, 0]; + this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0]); }; @@ -589,7 +612,17 @@ Phaser.Image.prototype.preUpdate = function() { return true; -}; +} + +/** +* Override and use this function in your own custom objects to handle any update requirements you may have. +* +* @method Phaser.Image#update +* @memberof Phaser.Image +*/ +Phaser.Image.prototype.update = function() { + +} /** * Internal function called by the World postUpdate cycle. @@ -604,22 +637,23 @@ Phaser.Image.prototype.postUpdate = function() { this.key.render(); } - if (this.fixedToCamera) + // Fixed to Camera? + if (this._cache[7] === 1) { - this.position.x = this.game.camera.view.x + this.x; - this.position.y = this.game.camera.view.y + this.y; + this.position.x = this.game.camera.view.x + this.cameraOffset.x; + this.position.y = this.game.camera.view.y + this.cameraOffset.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. +* Changes the Texture the Image 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. +* @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or 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.prototype.loadTexture = function (key, frame) { @@ -629,16 +663,19 @@ Phaser.Image.prototype.loadTexture = function (key, frame) { { this.key = key.key; this.setTexture(key); + return; } else if (key instanceof Phaser.BitmapData) { this.key = key.key; this.setTexture(key.texture); + return; } else if (key instanceof PIXI.Texture) { this.key = key; this.setTexture(key); + return; } else { @@ -646,11 +683,13 @@ Phaser.Image.prototype.loadTexture = function (key, frame) { { this.key = '__default'; this.setTexture(PIXI.TextureCache[this.key]); + return; } else if (typeof key === 'string' && !this.game.cache.checkImageKey(key)) { this.key = '__missing'; this.setTexture(PIXI.TextureCache[this.key]); + return; } if (this.game.cache.isSpriteSheet(key)) @@ -664,22 +703,25 @@ Phaser.Image.prototype.loadTexture = function (key, frame) { this._frame = 0; this._frameName = frame; this.setTexture(PIXI.TextureCache[frameData.getFrameByName(frame).uuid]); + return; } else { this._frame = frame; this._frameName = ''; this.setTexture(PIXI.TextureCache[frameData.getFrame(frame).uuid]); + return; } } else { this.key = key; this.setTexture(PIXI.TextureCache[key]); + return; } } -}; +} /** * Crop allows you to crop the texture used to display this Image. @@ -726,12 +768,12 @@ Phaser.Image.prototype.crop = function(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. +* Brings a 'dead' Image back to life, optionally giving it the health value specified. +* A resurrected Image has its alive, exists and visible properties all set to true. +* It will dispatch the onRevived event, you can listen to Image.events.onRevived for the signal. * * @method Phaser.Image#revive * @memberof Phaser.Image @@ -750,13 +792,13 @@ Phaser.Image.prototype.revive = function() { 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. +* Kills a Image. A killed Image has its alive, exists and visible properties all set to false. +* It will dispatch the onKilled event, you can listen to Image.events.onKilled for the signal. +* Note that killing a Image is a way for you to quickly recycle it in a Image pool, it doesn't free it up from memory. +* If you don't need this Image any more you should call Image.destroy instead. * * @method Phaser.Image#kill * @memberof Phaser.Image @@ -775,10 +817,10 @@ Phaser.Image.prototype.kill = function() { return this; -}; +} /** -* Destroys the Sprite. This removes it from its parent group, destroys the input, event and animation handlers if present +* Destroys the Image. 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 @@ -812,15 +854,15 @@ Phaser.Image.prototype.destroy = function() { 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. +* Resets the Image. This places the Image 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. +* @param {number} x - The x coordinate (in world space) to position the Image at. +* @param {number} y - The y coordinate (in world space) to position the Image at. * @return {Phaser.Image} This instance. */ Phaser.Image.prototype.reset = function(x, y) { @@ -835,10 +877,10 @@ Phaser.Image.prototype.reset = function(x, y) { 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 +* Brings the Image to the top of the display list it is a child of. Images 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 @@ -861,12 +903,12 @@ Phaser.Image.prototype.bringToTop = function(child) { 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. +* Indicates the rotation of the Image, 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. +* If you wish to work in radians instead of degrees use the property Image.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. @@ -1079,6 +1121,37 @@ Object.defineProperty(Phaser.Image.prototype, "inputEnabled", { } } +}); + +/** +* An Image that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Image.cameraOffset. +* Note that the cameraOffset values are in addition to any parent in the display list. +* So if this Image was in a Group that has x: 200, then this will be added to the cameraOffset.x +* +* @name Phaser.Image#fixedToCamera +* @property {boolean} fixedToCamera - Set to true to fix this Image to the Camera at its current world coordinates. +*/ +Object.defineProperty(Phaser.Image.prototype, "fixedToCamera", { + + get: function () { + + return !!this._cache[7]; + + }, + + set: function (value) { + + if (value) + { + this._cache[7] = 1; + this.cameraOffset.set(this.x, this.y); + } + else + { + this._cache[7] = 0; + } + } + }); @@ -1101,7 +1174,7 @@ Object.defineProperty(Phaser.Image.prototype, "inputEnabled", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Input.js.html b/docs/Input.js.html index 1efb8a8c..11bda62c 100644 --- a/docs/Input.js.html +++ b/docs/Input.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1346,7 +1354,7 @@ Object.defineProperty(Phaser.Input.prototype, "worldY", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/InputHandler.js.html b/docs/InputHandler.js.html index 9e85cf47..751058ff 100644 --- a/docs/InputHandler.js.html +++ b/docs/InputHandler.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -558,10 +566,22 @@ Phaser.InputHandler = function (sprite) { this.snapOffsetY = 0; /** - * @property {number} pixelPerfect - Should we use pixel perfect hit detection? Warning: expensive. Only enable if you really need it! + * Set to true to use pixel perfect hit detection when checking if the pointer is over this Sprite. + * The x/y coordinates of the pointer are tested against the image in combination with the InputHandler.pixelPerfectAlpha value. + * Warning: This is expensive, especially on mobile (where it's not even needed!) so only enable if required. Also see the less-expensive InputHandler.pixelPerfectClick. + * @property {number} pixelPerfectOver - Use a pixel perfect check when testing for pointer over. * @default */ - this.pixelPerfect = false; + this.pixelPerfectOver = false; + + /** + * Set to true to use pixel perfect hit detection when checking if the pointer is over this Sprite when it's clicked or touched. + * The x/y coordinates of the pointer are tested against the image in combination with the InputHandler.pixelPerfectAlpha value. + * Warning: This is expensive so only enable if you really need it. + * @property {number} pixelPerfectClick - Use a pixel perfect check when testing for clicks or touches on the Sprite. + * @default + */ + this.pixelPerfectClick = false; /** * @property {number} pixelPerfectAlpha - The alpha tolerance threshold. If the alpha value of the pixel matches or is above this value, it's considered a hit. @@ -596,11 +616,15 @@ Phaser.InputHandler = function (sprite) { this.consumePointerEvent = false; /** - * @property {Phaser.Point} _tempPoint - Description. + * @property {Phaser.Point} _tempPoint - Internal cache var. * @private */ this._tempPoint = new Phaser.Point(); + /** + * @property {array} _pointerData - Internal cache var. + * @private + */ this._pointerData = []; this._pointerData.push({ @@ -741,10 +765,12 @@ Phaser.InputHandler.prototype = { this.game.input.interactiveItems.remove(this); - this.stop(); - + this._pointerData.length = 0; + this.boundsRect = null; + this.boundsSprite = null; this.sprite = null; } + }, /** @@ -935,6 +961,36 @@ Phaser.InputHandler.prototype = { }, + /** + * Checks if the given pointer is over this Sprite and can click it. + * @method Phaser.InputHandler#checkPointerDown + * @param {Phaser.Pointer} pointer + * @return {boolean} + */ + checkPointerDown: function (pointer) { + + if (this.enabled === false || this.sprite.visible === false || this.sprite.parent.visible === false) + { + return false; + } + + // 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.pixelPerfectClick) + { + return this.checkPixel(this._tempPoint.x, this._tempPoint.y); + } + else + { + return true; + } + } + + return false; + + }, + /** * Checks if the given pointer is over this Sprite. * @method Phaser.InputHandler#checkPointerOver @@ -951,7 +1007,7 @@ Phaser.InputHandler.prototype = { // 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) + if (this.pixelPerfectOver) { return this.checkPixel(this._tempPoint.x, this._tempPoint.y); } @@ -971,15 +1027,35 @@ Phaser.InputHandler.prototype = { * @method Phaser.InputHandler#checkPixel * @param {number} x - The x coordinate to check. * @param {number} y - The y coordinate to check. + * @param {Phaser.Pointer} [pointer] - The pointer to get the x/y coordinate from if not passed as the first two parameters. * @return {boolean} true if there is the alpha of the pixel is >= InputHandler.pixelPerfectAlpha */ - checkPixel: function (x, y) { + checkPixel: function (x, y, pointer) { // Grab a pixel from our image into the hitCanvas and then test it if (this.sprite.texture.baseTexture.source) { this.game.input.hitContext.clearRect(0, 0, 1, 1); + if (x === null && y === null) + { + // Use the pointer parameter + this.game.input.getLocalPosition(this.sprite, pointer, this._tempPoint); + + var x = this._tempPoint.x; + var y = this._tempPoint.y; + } + + if (this.sprite.anchor.x !== 0) + { + x -= -this.sprite.texture.frame.width * this.sprite.anchor.x; + } + + if (this.sprite.anchor.y !== 0) + { + y -= -this.sprite.texture.frame.height * this.sprite.anchor.y; + } + x += this.sprite.texture.frame.x; y += this.sprite.texture.frame.y; @@ -1000,10 +1076,17 @@ Phaser.InputHandler.prototype = { /** * Update. * @method Phaser.InputHandler#update + * @protected * @param {Phaser.Pointer} pointer */ update: function (pointer) { + if (this.sprite === null) + { + // Abort. We've been destroyed. + return; + } + if (this.enabled === false || this.sprite.visible === false || (this.sprite.group && this.sprite.group.visible === false)) { this._pointerOutHandler(pointer); @@ -1038,6 +1121,12 @@ Phaser.InputHandler.prototype = { */ _pointerOverHandler: function (pointer) { + if (this.sprite === null) + { + // Abort. We've been destroyed. + return; + } + if (this._pointerData[pointer.id].isOver === false) { this._pointerData[pointer.id].isOver = true; @@ -1053,6 +1142,7 @@ Phaser.InputHandler.prototype = { this.sprite.events.onInputOver.dispatch(this.sprite, pointer); } + }, /** @@ -1063,6 +1153,12 @@ Phaser.InputHandler.prototype = { */ _pointerOutHandler: function (pointer) { + if (this.sprite === null) + { + // Abort. We've been destroyed. + return; + } + this._pointerData[pointer.id].isOver = false; this._pointerData[pointer.id].isOut = true; this._pointerData[pointer.id].timeOut = this.game.time.now; @@ -1087,8 +1183,19 @@ Phaser.InputHandler.prototype = { */ _touchedHandler: function (pointer) { + if (this.sprite === null) + { + // Abort. We've been destroyed. + return; + } + if (this._pointerData[pointer.id].isDown === false && this._pointerData[pointer.id].isOver === true) { + if (this.pixelPerfectClick && !this.checkPixel(null, null, pointer)) + { + return; + } + this._pointerData[pointer.id].isDown = true; this._pointerData[pointer.id].isUp = false; this._pointerData[pointer.id].timeDown = this.game.time.now; @@ -1119,6 +1226,12 @@ Phaser.InputHandler.prototype = { */ _releasedHandler: function (pointer) { + if (this.sprite === null) + { + // Abort. We've been destroyed. + return; + } + // If was previously touched by this Pointer, check if still is AND still over this item if (this._pointerData[pointer.id].isDown && pointer.isUp) { @@ -1262,7 +1375,7 @@ Phaser.InputHandler.prototype = { }, /** - * Returns true if the pointer has entered the Sprite within the specified delay time (defaults to 500ms, half a second) + * Returns true if the pointer has touched or clicked on the Sprite within the specified delay time (defaults to 500ms, half a second) * @method Phaser.InputHandler#justPressed * @param {Phaser.Pointer} pointer * @param {number} delay - The time below which the pointer is considered as just over. @@ -1278,7 +1391,7 @@ Phaser.InputHandler.prototype = { }, /** - * Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second) + * Returns true if the pointer was touching this Sprite, but has been released within the specified delay time (defaults to 500ms, half a second) * @method Phaser.InputHandler#justReleased * @param {Phaser.Pointer} pointer * @param {number} delay - The time below which the pointer is considered as just out. @@ -1649,7 +1762,7 @@ Phaser.InputHandler.prototype.constructor = Phaser.InputHandler; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Key.js.html b/docs/Key.js.html index df9a0c26..1312cd87 100644 --- a/docs/Key.js.html +++ b/docs/Key.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -643,7 +651,7 @@ Phaser.Key.prototype.constructor = Phaser.Key; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Keyboard.js.html b/docs/Keyboard.js.html index ab68e49c..d1987a49 100644 --- a/docs/Keyboard.js.html +++ b/docs/Keyboard.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -967,7 +975,7 @@ Phaser.Keyboard.NUM_LOCK = 144; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Line.js.html b/docs/Line.js.html index 5ffbda4c..efd58205 100644 --- a/docs/Line.js.html +++ b/docs/Line.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -734,7 +742,7 @@ Phaser.Line.intersects = function (a, b, asSegment, result) { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/LinkedList.js.html b/docs/LinkedList.js.html index aecaa08d..1797f281 100644 --- a/docs/LinkedList.js.html +++ b/docs/LinkedList.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -626,7 +634,7 @@ Phaser.LinkedList.prototype.constructor = Phaser.LinkedList; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Loader.js.html b/docs/Loader.js.html index b2803dfe..7401d6d4 100644 --- a/docs/Loader.js.html +++ b/docs/Loader.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -523,16 +531,17 @@ Phaser.Loader = function (game) { /** * You can optionally link a sprite to the preloader. - * If you do so the Sprite's width or height will be cropped based on the percentage loaded. - * @property {Phaser.Sprite} preloadSprite + * If you do so the Sprites width or height will be cropped based on the percentage loaded. + * @property {Phaser.Sprite|Phaser.Image} preloadSprite * @default */ this.preloadSprite = null; /** - * @property {string} crossOrigin - The crossOrigin value applied to loaded images + * @property {boolean|string} crossOrigin - The crossOrigin value applied to loaded images. + * @default */ - this.crossOrigin = ''; + this.crossOrigin = false; /** * If you want to append a URL before the path of any asset you can set this here. @@ -583,6 +592,12 @@ Phaser.Loader.TEXTURE_ATLAS_JSON_HASH = 1; */ Phaser.Loader.TEXTURE_ATLAS_XML_STARLING = 2; +/** +* @constant +* @type {number} +*/ +Phaser.Loader.PHYSICS_LIME_CORONA = 3; + Phaser.Loader.prototype = { /** @@ -611,8 +626,7 @@ Phaser.Loader.prototype = { this.preloadSprite.crop = new Phaser.Rectangle(0, 0, sprite.width, 1); } - sprite.crop = this.preloadSprite.crop; - sprite.cropEnabled = true; + sprite.crop(this.preloadSprite.crop); }, @@ -940,6 +954,49 @@ Phaser.Loader.prototype = { }, + /** + * Add a new physics data object loading request. + * The data must be in Lime + Corona JSON format. Physics Editor by code'n'web exports in this format natively. + * + * @method Phaser.Loader#physics + * @param {string} key - Unique asset key of the physics json data. + * @param {string} [dataURL] - The url of the map data file (csv/json) + * @param {object} [jsonData] - An optional JSON data object. If given then the dataURL is ignored and this JSON object is used for physics data instead. + * @param {string} [format=Phaser.Physics.LIME_CORONA_JSON] - The format of the physics data. + * @return {Phaser.Loader} This Loader instance. + */ + physics: function (key, dataURL, jsonData, format) { + + if (typeof dataURL === "undefined") { dataURL = null; } + if (typeof jsonData === "undefined") { jsonData = null; } + if (typeof format === "undefined") { format = Phaser.Physics.LIME_CORONA_JSON; } + + if (dataURL == null && jsonData == null) + { + console.warn('Phaser.Loader.physics - Both dataURL and jsonData are null. One must be set.'); + + return this; + } + + // A map data object has been given + if (jsonData) + { + if (typeof jsonData === 'string') + { + jsonData = JSON.parse(jsonData); + } + + this.game.cache.addPhysicsData(key, null, jsonData, format); + } + else + { + this.addToFileList('physics', key, dataURL, { format: format }); + } + + return this; + + }, + /** * Add a new bitmap font loading request. * @@ -948,17 +1005,21 @@ Phaser.Loader.prototype = { * @param {string} textureURL - The url of the font image file. * @param {string} [xmlURL] - The url of the font data file (xml/fnt) * @param {object} [xmlData] - An optional XML data object. + * @param {number} [xSpacing=0] - If you'd like to add additional horizontal spacing between the characters then set the pixel value here. + * @param {number} [ySpacing=0] - If you'd like to add additional vertical spacing between the lines then set the pixel value here. * @return {Phaser.Loader} This Loader instance. */ - bitmapFont: function (key, textureURL, xmlURL, xmlData) { + bitmapFont: function (key, textureURL, xmlURL, xmlData, xSpacing, ySpacing) { if (typeof xmlURL === "undefined") { xmlURL = null; } if (typeof xmlData === "undefined") { xmlData = null; } + if (typeof xSpacing === "undefined") { xSpacing = 0; } + if (typeof ySpacing === "undefined") { ySpacing = 0; } // A URL to a json/xml file has been given if (xmlURL) { - this.addToFileList('bitmapfont', key, textureURL, { xmlURL: xmlURL }); + this.addToFileList('bitmapfont', key, textureURL, { xmlURL: xmlURL, xSpacing: xSpacing, ySpacing: ySpacing }); } else { @@ -991,7 +1052,7 @@ Phaser.Loader.prototype = { } else { - this.addToFileList('bitmapfont', key, textureURL, { xmlURL: null, xmlData: xml }); + this.addToFileList('bitmapfont', key, textureURL, { xmlURL: null, xmlData: xml, xSpacing: xSpacing, ySpacing: ySpacing }); } } } @@ -1224,7 +1285,10 @@ Phaser.Loader.prototype = { file.data.onerror = function () { return _this.fileError(_this._fileIndex); }; - file.data.crossOrigin = this.crossOrigin; + if (this.crossOrigin) + { + file.data.crossOrigin = this.crossOrigin; + } file.data.src = this.baseURL + file.url; break; @@ -1307,6 +1371,7 @@ Phaser.Loader.prototype = { case 'text': case 'script': + case 'physics': this._xhr.open("GET", this.baseURL + file.url, true); this._xhr.responseType = "text"; this._xhr.onload = function () { @@ -1453,7 +1518,7 @@ Phaser.Loader.prototype = { if (file.xmlURL == null) { - this.game.cache.addBitmapFont(file.key, file.url, file.data, file.xmlData); + this.game.cache.addBitmapFont(file.key, file.url, file.data, file.xmlData, file.xSpacing, file.ySpacing); } else { @@ -1509,6 +1574,11 @@ Phaser.Loader.prototype = { this.game.cache.addText(file.key, file.url, file.data); break; + case 'physics': + var data = JSON.parse(this._xhr.responseText); + this.game.cache.addPhysicsData(file.key, file.url, data, file.format); + break; + case 'script': file.data = document.createElement('script'); file.data.language = 'javascript'; @@ -1656,7 +1726,7 @@ Phaser.Loader.prototype = { if (file.type == 'bitmapfont') { - this.game.cache.addBitmapFont(file.key, file.url, file.data, xml); + this.game.cache.addBitmapFont(file.key, file.url, file.data, xml, file.xSpacing, file.ySpacing); } else if (file.type == 'textureatlas') { @@ -1695,7 +1765,7 @@ Phaser.Loader.prototype = { this.preloadSprite.crop.height = Math.floor((this.preloadSprite.height / 100) * this.progress); } - this.preloadSprite.sprite.crop = this.preloadSprite.crop; + // this.preloadSprite.sprite.crop = this.preloadSprite.crop; } this.onFileComplete.dispatch(this.progress, this._fileList[previousIndex].key, success, this.totalLoadedFiles(), this._fileList.length); @@ -1783,7 +1853,7 @@ Phaser.Loader.prototype.constructor = Phaser.Loader; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/LoaderParser.js.html b/docs/LoaderParser.js.html index 428cbb5f..57ef58ee 100644 --- a/docs/LoaderParser.js.html +++ b/docs/LoaderParser.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -461,73 +469,75 @@ * @class Phaser.LoaderParser */ Phaser.LoaderParser = { - - /** - * Parse frame data from an XML file. - * @method Phaser.LoaderParser.bitmapFont - * @param {object} xml - XML data you want to parse. - * @return {FrameData} Generated FrameData object. - */ - bitmapFont: function (game, xml, cacheKey) { - // Malformed? - if (!xml.getElementsByTagName('font')) + /** + * Parse a Bitmap Font from an XML file. + * @method Phaser.LoaderParser.bitmapFont + * @param {Phaser.Game} game - A reference to the current game. + * @param {object} xml - XML data you want to parse. + * @param {string} cacheKey - The key of the texture this font uses in the cache. + */ + bitmapFont: function (game, xml, cacheKey, xSpacing, ySpacing) { + + if (!xml || /MSIE 9/i.test(navigator.userAgent) || navigator.isCocoonJS) { - console.warn("Phaser.LoaderParser.bitmapFont: Invalid XML given, missing <font> tag"); - return; + if (typeof(window.DOMParser) === 'function') + { + var domparser = new DOMParser(); + xml = domparser.parseFromString(this.ajaxRequest.responseText, 'text/xml'); + } + else + { + var div = document.createElement('div'); + div.innerHTML = this.ajaxRequest.responseText; + xml = div; + } } - var texture = PIXI.TextureCache[cacheKey]; - var data = {}; - var info = xml.getElementsByTagName("info")[0]; - var common = xml.getElementsByTagName("common")[0]; - data.font = info.attributes.getNamedItem("face").nodeValue; - data.size = parseInt(info.attributes.getNamedItem("size").nodeValue, 10); - data.lineHeight = parseInt(common.attributes.getNamedItem("lineHeight").nodeValue, 10); + var info = xml.getElementsByTagName('info')[0]; + var common = xml.getElementsByTagName('common')[0]; + + data.font = info.getAttribute('face'); + data.size = parseInt(info.getAttribute('size'), 10); + data.lineHeight = parseInt(common.getAttribute('lineHeight'), 10) + ySpacing; data.chars = {}; - //parse letters - var letters = xml.getElementsByTagName("char"); + var letters = xml.getElementsByTagName('char'); + var texture = PIXI.TextureCache[cacheKey]; for (var i = 0; i < letters.length; i++) { - var charCode = parseInt(letters[i].attributes.getNamedItem("id").nodeValue, 10); + var charCode = parseInt(letters[i].getAttribute('id'), 10); - var textureRect = { - x: parseInt(letters[i].attributes.getNamedItem("x").nodeValue, 10), - y: parseInt(letters[i].attributes.getNamedItem("y").nodeValue, 10), - width: parseInt(letters[i].attributes.getNamedItem("width").nodeValue, 10), - height: parseInt(letters[i].attributes.getNamedItem("height").nodeValue, 10) - }; - - // Note: This means you can only have 1 BitmapFont loaded at once! - // Need to replace this with our own handler soon. - PIXI.TextureCache[charCode] = new PIXI.Texture(texture, textureRect); + var textureRect = new PIXI.Rectangle( + parseInt(letters[i].getAttribute('x'), 10), + parseInt(letters[i].getAttribute('y'), 10), + parseInt(letters[i].getAttribute('width'), 10), + parseInt(letters[i].getAttribute('height'), 10) + ); data.chars[charCode] = { - xOffset: parseInt(letters[i].attributes.getNamedItem("xoffset").nodeValue, 10), - yOffset: parseInt(letters[i].attributes.getNamedItem("yoffset").nodeValue, 10), - xAdvance: parseInt(letters[i].attributes.getNamedItem("xadvance").nodeValue, 10), + xOffset: parseInt(letters[i].getAttribute('xoffset'), 10), + yOffset: parseInt(letters[i].getAttribute('yoffset'), 10), + xAdvance: parseInt(letters[i].getAttribute('xadvance'), 10) + xSpacing, kerning: {}, - texture:new PIXI.Texture(texture, textureRect) - + texture: PIXI.TextureCache[cacheKey] = new PIXI.Texture(texture, textureRect) }; } - //parse kernings - var kernings = xml.getElementsByTagName("kerning"); + var kernings = xml.getElementsByTagName('kerning'); for (i = 0; i < kernings.length; i++) { - var first = parseInt(kernings[i].attributes.getNamedItem("first").nodeValue, 10); - var second = parseInt(kernings[i].attributes.getNamedItem("second").nodeValue, 10); - var amount = parseInt(kernings[i].attributes.getNamedItem("amount").nodeValue, 10); + var first = parseInt(kernings[i].getAttribute('first'), 10); + var second = parseInt(kernings[i].getAttribute('second'), 10); + var amount = parseInt(kernings[i].getAttribute('amount'), 10); data.chars[second].kerning[first] = amount; } - PIXI.BitmapText.fonts[data.font] = data; + PIXI.BitmapText.fonts[cacheKey] = data; } @@ -552,7 +562,7 @@ Phaser.LoaderParser = { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/MSPointer.js.html b/docs/MSPointer.js.html index 44fa56e6..4b69639c 100644 --- a/docs/MSPointer.js.html +++ b/docs/MSPointer.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -606,13 +614,13 @@ Phaser.MSPointer.prototype = { */ stop: function () { - this.game.stage.canvas.removeEventListener('MSPointerDown', this._onMSPointerDown); - this.game.stage.canvas.removeEventListener('MSPointerMove', this._onMSPointerMove); - this.game.stage.canvas.removeEventListener('MSPointerUp', this._onMSPointerUp); + this.game.canvas.removeEventListener('MSPointerDown', this._onMSPointerDown); + this.game.canvas.removeEventListener('MSPointerMove', this._onMSPointerMove); + this.game.canvas.removeEventListener('MSPointerUp', this._onMSPointerUp); - this.game.stage.canvas.removeEventListener('pointerDown', this._onMSPointerDown); - this.game.stage.canvas.removeEventListener('pointerMove', this._onMSPointerMove); - this.game.stage.canvas.removeEventListener('pointerUp', this._onMSPointerUp); + this.game.canvas.removeEventListener('pointerDown', this._onMSPointerDown); + this.game.canvas.removeEventListener('pointerMove', this._onMSPointerMove); + this.game.canvas.removeEventListener('pointerUp', this._onMSPointerUp); } @@ -640,7 +648,7 @@ Phaser.MSPointer.prototype.constructor = Phaser.MSPointer; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Math.js.html b/docs/Math.js.html index 4dd11bc1..f31aa3ba 100644 --- a/docs/Math.js.html +++ b/docs/Math.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -787,7 +795,18 @@ Phaser.Math = { * @return {number} */ angleBetween: function (x1, y1, x2, y2) { - return Math.atan2(y2 - y1, x2 - x1); + return Math.atan2(x2 - x1, y2 - y1); + }, + + /** + * Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y). + * @method Phaser.Math#angleBetweenPoints + * @param {Phaser.Point} point1 + * @param {Phaser.Point} point2 + * @return {number} + */ + angleBetweenPoints: function (point1, point2) { + return Math.atan2(point2.x - point1.x, point2.y - point1.y); }, /** @@ -1731,6 +1750,28 @@ Phaser.Math = { }, + /** + * Convert p2 physics value to pixel scale. + * + * @method Phaser.Math#p2px + * @param {number} v - The value to convert. + * @return {number} The scaled value. + */ + p2px: function (v) { + return v *= -20; + }, + + /** + * Convert pixel value to p2 physics scale. + * + * @method Phaser.Math#px2p + * @param {number} v - The value to convert. + * @return {number} The scaled value. + */ + px2p: function (v) { + return v * -0.05; + }, + /** * Convert degrees to radians. * @@ -1789,7 +1830,7 @@ Phaser.Math = { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Mouse.js.html b/docs/Mouse.js.html index ab41d38f..51911a99 100644 --- a/docs/Mouse.js.html +++ b/docs/Mouse.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -596,9 +604,9 @@ Phaser.Mouse.prototype = { return _this.onMouseUp(event); }; - document.addEventListener('mousedown', this._onMouseDown, true); - document.addEventListener('mousemove', this._onMouseMove, true); - document.addEventListener('mouseup', this._onMouseUp, true); + this.game.canvas.addEventListener('mousedown', this._onMouseDown, true); + this.game.canvas.addEventListener('mousemove', this._onMouseMove, true); + this.game.canvas.addEventListener('mouseup', this._onMouseUp, true); }, @@ -706,7 +714,7 @@ Phaser.Mouse.prototype = { if (this.game.device.pointerLock) { - var element = this.game.stage.canvas; + var element = this.game.canvas; element.requestPointerLock = element.requestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock; @@ -732,7 +740,7 @@ Phaser.Mouse.prototype = { */ pointerLockChange: function (event) { - var element = this.game.stage.canvas; + var element = this.game.canvas; if (document.pointerLockElement === element || document.mozPointerLockElement === element || document.webkitPointerLockElement === element) { @@ -771,9 +779,9 @@ Phaser.Mouse.prototype = { */ stop: function () { - document.removeEventListener('mousedown', this._onMouseDown, true); - document.removeEventListener('mousemove', this._onMouseMove, true); - document.removeEventListener('mouseup', this._onMouseUp, true); + this.game.canvas.removeEventListener('mousedown', this._onMouseDown, true); + this.game.canvas.removeEventListener('mousemove', this._onMouseMove, true); + this.game.canvas.removeEventListener('mouseup', this._onMouseUp, true); } @@ -801,7 +809,7 @@ Phaser.Mouse.prototype.constructor = Phaser.Mouse; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Net.js.html b/docs/Net.js.html index 827ec5b7..40f01232 100644 --- a/docs/Net.js.html +++ b/docs/Net.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -636,7 +644,7 @@ Phaser.Net.prototype.constructor = Phaser.Net; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Particles.js.html b/docs/Particles.js.html index ccee8cbf..58bbf25c 100644 --- a/docs/Particles.js.html +++ b/docs/Particles.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -551,7 +559,7 @@ Phaser.Particles.prototype.constructor = Phaser.Particles; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Animation.html b/docs/Phaser.Animation.html index 85dddc8e..65a748f4 100644 --- a/docs/Phaser.Animation.html +++ b/docs/Phaser.Animation.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1030,7 +1038,7 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
    Source:
    @@ -1132,7 +1140,7 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
    Source:
    @@ -1960,7 +1968,7 @@ It is created by the AnimationManager, consists of Animation.Frame objects and b
    Source:
    @@ -2240,7 +2248,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
    Source:
    @@ -2309,7 +2317,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
    Source:
    @@ -2378,7 +2386,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
    Source:
    @@ -2688,7 +2696,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
    Source:
    @@ -2826,7 +2834,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
    Source:
    @@ -2895,7 +2903,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat
    Source:
    @@ -2946,7 +2954,7 @@ You could use this function to generate those by doing: Phaser.Animation.generat Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.AnimationManager.html b/docs/Phaser.AnimationManager.html index 6abdf7aa..93fdf948 100644 --- a/docs/Phaser.AnimationManager.html +++ b/docs/Phaser.AnimationManager.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -790,7 +798,7 @@ Any Game Object such as Phaser.Sprite that supports animation contains a single
    Source:
    @@ -892,7 +900,7 @@ Any Game Object such as Phaser.Sprite that supports animation contains a single
    Source:
    @@ -994,7 +1002,7 @@ Any Game Object such as Phaser.Sprite that supports animation contains a single
    Source:
    @@ -1096,7 +1104,7 @@ Any Game Object such as Phaser.Sprite that supports animation contains a single
    Source:
    @@ -1405,7 +1413,7 @@ Any Game Object such as Phaser.Sprite that supports animation contains a single
    Source:
    @@ -1991,7 +1999,7 @@ Animations added in this way are played back with the play function.

    Source:
    @@ -2109,7 +2117,7 @@ Animations added in this way are played back with the play function.

    Source:
    @@ -2384,7 +2392,7 @@ If the requested animation is already playing this request will be ignored. If y
    Source:
    @@ -2476,7 +2484,7 @@ If the requested animation is already playing this request will be ignored. If y
    Source:
    @@ -2654,7 +2662,7 @@ The currentAnim property of the AnimationManager is automatically set to the ani
    Source:
    @@ -2723,7 +2731,7 @@ The currentAnim property of the AnimationManager is automatically set to the ani
    Source:
    @@ -2919,7 +2927,7 @@ The currentAnim property of the AnimationManager is automatically set to the ani
    Source:
    @@ -2993,7 +3001,7 @@ The currentAnim property of the AnimationManager is automatically set to the ani Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.AnimationParser.html b/docs/Phaser.AnimationParser.html index fbea0e16..6986040d 100644 --- a/docs/Phaser.AnimationParser.html +++ b/docs/Phaser.AnimationParser.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -874,7 +882,7 @@
    Source:
    @@ -1440,7 +1448,7 @@
    Source:
    @@ -1514,7 +1522,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.BitmapData.html b/docs/Phaser.BitmapData.html index b4f4166d..006587cd 100644 --- a/docs/Phaser.BitmapData.html +++ b/docs/Phaser.BitmapData.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -455,10 +463,8 @@ BitmapData -

    Note: This object is still experimental and likely to change.

    -

    A BitmapData object can be thought of as a blank canvas onto which you can perform graphics operations as you would on a normal canvas, -such as drawing lines, circles, arcs, fills and copying and setting blocks of pixel data. A single BitmapData can be used as the texture -for multiple Sprites. So if you need to dynamically create a Sprite texture then they are a good choice. It supports the EaselJS Tiny API.

    +

    A BitmapData object contains a Canvas element to which you can draw anything you like via normal Canvas context operations. +A single BitmapData can be used as the texture one or many Images/Sprites. So if you need to dynamically create a Sprite texture then they are a good choice.

    @@ -688,7 +694,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -816,7 +822,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -918,7 +924,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1020,7 +1026,109 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    + + + + + + + + + + + + + + + +
    +

    ctx

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    ctx + + +CanvasRenderingContext2D + + + +

    A reference to BitmapData.context.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1122,7 +1230,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1224,7 +1332,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1326,7 +1434,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1428,7 +1536,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1530,7 +1638,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1632,7 +1740,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1734,7 +1842,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1836,7 +1944,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1938,7 +2046,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -1962,7 +2070,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    -

    a()

    +

    add(object)

    @@ -1970,76 +2078,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    -

    Shortcut to arc.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    add(sprite)

    - - -
    -
    - - -
    -

    Updates the given Sprite so that it uses this BitmapData as its texture.

    +

    Updates the given objects so that they use this BitmapData as their texture.

    @@ -2073,13 +2112,22 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then - sprite + object Phaser.Sprite +| + +Array.<Phaser.Sprite> +| + +Phaser.Image +| + +Array.<Phaser.Image> @@ -2089,7 +2137,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then -

    The sprite to apply this texture to.

    +

    Either a single Sprite/Image or an Array of Sprites/Images.

    @@ -2121,7 +2169,7 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then
    Source:
    @@ -2144,2679 +2192,6 @@ for multiple Sprites. So if you need to dynamically create a Sprite texture then - - - - -
    -

    addTo(sprites)

    - - -
    -
    - - -
    -

    Given an array of Sprites it will update each of them so that their Textures reference this BitmapData.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    sprites - - -Phaser.Sprite[] - - - -

    An array of Sprites to apply this texture to.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    arc(x, y, radius, startAngle, endAngle, anticlockwise) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Adds an arc to the path which is centered at (x, y) position with radius r starting at startAngle and ending at endAngle -going in the given direction by anticlockwise (defaulting to clockwise).

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDefaultDescription
    x - - -number - - - - - - - - - - - -

    The x axis of the coordinate for the arc's center

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

    The y axis of the coordinate for the arc's center

    radius - - -number - - - - - - - - - - - -

    The arc's radius

    startAngle - - -number - - - - - - - - - - - -

    The starting point, measured from the x axis, from which it will be drawn, expressed in radians.

    endAngle - - -number - - - - - - - - - - - -

    The end arc's angle to which it will be drawn, expressed in radians.

    anticlockwise - - -boolean - - - - - - <optional>
    - - - - - -
    - - true - -

    true draws the arc anticlockwise, otherwise in a clockwise direction.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    arcTo(x1, y1, x2, y2, radius) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Adds an arc with the given control points and radius, connected to the previous point by a straight line.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    x1 - - -number - - - -
    y1 - - -number - - - -
    x2 - - -number - - - -
    y2 - - -number - - - -
    radius - - -number - - - -
    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    at()

    - - -
    -
    - - -
    -

    Shortcut to arcTo.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    beginFill(color) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Begins a fill with the specified color. This ends the current sub-path.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    color - - -string - - - -

    A CSS compatible color value (ex. "red", "#FF0000", or "rgba(255,0,0,0.5)"). Setting to null will result in no fill.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    beginLinearGradientFill(colors, ratios, x0, y0, x1, y1) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Begins a linear gradient fill defined by the line (x0, y0) to (x1, y1). This ends the current sub-path. For -example, the following code defines a black to white vertical gradient ranging from 20px to 120px, and draws a square to display it:

    -
     ```myGraphics.beginLinearGradientFill(["#000","#FFF"], [0, 1], 0, 20, 0, 120).rect(20, 20, 120, 120);```
    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    colors - - -Array - - - -

    An array of CSS compatible color values. For example, ["#F00","#00F"] would define a gradient drawing from red to blue.

    ratios - - -Array - - - -

    An array of gradient positions which correspond to the colors. For example, [0.1, 0.9] would draw the first color to 10% then interpolating to the second color at 90%.

    x0 - - -number - - - -

    The position of the first point defining the line that defines the gradient direction and size.

    y0 - - -number - - - -

    The position of the first point defining the line that defines the gradient direction and size.

    x1 - - -number - - - -

    The position of the second point defining the line that defines the gradient direction and size.

    y1 - - -number - - - -

    The position of the second point defining the line that defines the gradient direction and size.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    beginLinearGradientStroke(colors, ratios, x0, y0, x1, y1) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Begins a linear gradient stroke defined by the line (x0, y0) to (x1, y1). This ends the current sub-path. For -example, the following code defines a black to white vertical gradient ranging from 20px to 120px, and draws a -square to display it:

    -
     ```myGraphics.setStrokeStyle(10).beginLinearGradientStroke(["#000","#FFF"], [0, 1], 0, 20, 0, 120).drawRect(20, 20, 120, 120);```
    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    colors - - -Array - - - -

    An array of CSS compatible color values. For example, ["#F00","#00F"] would define a gradient drawing from red to blue.

    ratios - - -Array - - - -

    An array of gradient positions which correspond to the colors. For example, [0.1, 0.9] would draw the first color to 10% then interpolating to the second color at 90%.

    x0 - - -number - - - -

    The position of the first point defining the line that defines the gradient direction and size.

    y0 - - -number - - - -

    The position of the first point defining the line that defines the gradient direction and size.

    x1 - - -number - - - -

    The position of the second point defining the line that defines the gradient direction and size.

    y1 - - -number - - - -

    The position of the second point defining the line that defines the gradient direction and size.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    beginPath() → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Starts a new path by resetting the list of sub-paths. Call this method when you want to create a new path.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    beginRadialGradientStroke(colors, ratios, x0, y0, r0, x1, y1, r1) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Begins a radial gradient stroke. This ends the current sub-path. For example, the following code defines a red to -blue radial gradient centered at (100, 100), with a radius of 50, and draws a rectangle to display it:

    -
     myGraphics.setStrokeStyle(10)
    -     .beginRadialGradientStroke(["#F00","#00F"], [0, 1], 100, 100, 0, 100, 100, 50)
    -     .drawRect(50, 90, 150, 110);
    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    colors - - -Array - - - -

    An array of CSS compatible color values. For example, ["#F00","#00F"] would define a gradient drawing from red to blue.

    ratios - - -Array - - - -

    An array of gradient positions which correspond to the colors. For example, [0.1, 0.9] would draw the first color to 10% then interpolating to the second color at 90%.

    x0 - - -number - - - -

    Center position of the inner circle that defines the gradient.

    y0 - - -number - - - -

    Center position of the inner circle that defines the gradient.

    r0 - - -number - - - -

    Radius of the inner circle that defines the gradient.

    x1 - - -number - - - -

    Center position of the outer circle that defines the gradient.

    y1 - - -number - - - -

    Center position of the outer circle that defines the gradient.

    r1 - - -number - - - -

    Radius of the outer circle that defines the gradient.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    beginStroke(color) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Begins a stroke with the specified color. This ends the current sub-path.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    color - - -String - - - -

    A CSS compatible color value (ex. "#FF0000", "red", or "rgba(255,0,0,0.5)"). Setting to null will result in no stroke.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Adds a bezier curve from the current context point to (x, y) using the control points (cp1x, cp1y) and (cp2x, cp2y).

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    cp1x - - -number - - - -

    The x axis of control point 1.

    cp1y - - -number - - - -

    The y axis of control point 1.

    cp2x - - -number - - - -

    The x axis of control point 2.

    cp2y - - -number - - - -

    The y axis of control point 2.

    x - - -number - - - -

    The x axis of the ending point.

    y - - -number - - - -

    The y axis of the ending point.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    bf()

    - - -
    -
    - - -
    -

    Shortcut to beginBitmapFill.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    bs()

    - - -
    -
    - - -
    -

    Shortcut to beginBitmapStroke.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    bt()

    - - -
    -
    - - -
    -

    Shortcut to bezierCurveTo.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    c()

    - - -
    -
    - - -
    -

    Shortcut to clear.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    circle(x, y, radius) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Draws a circle with the specified radius at (x, y).

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    x - - -number - - - -

    x coordinate center point of circle.

    y - - -number - - - -

    y coordinate center point of circle.

    radius - - -number - - - -

    Radius of circle in radians.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - -
    @@ -4863,7 +2238,7 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re
    Source:
    @@ -4886,2213 +2261,6 @@ blue radial gradient centered at (100, 100), with a radius of 50, and draws a re - - - - -
    -

    clearRect(x, y, width, height) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    x - - -number - - - -

    The x axis of the coordinate for the rectangle starting point.

    y - - -number - - - -

    The y axis of the coordinate for the rectangle starting point.

    width - - -number - - - -

    The rectangles width.

    height - - -number - - - -

    The rectangles height.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    clip() → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Creates a clipping path from the current sub-paths. Everything drawn after clip() is called appears inside the clipping path only.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    closePath() → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Tries to draw a straight line from the current point to the start. If the shape has already been closed or has only one point, this function does nothing.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    cp()

    - - -
    -
    - - -
    -

    Shortcut to closePath.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    createLinearGradient(x, y, width, height) → {CanvasGradient}

    - - -
    -
    - - -
    -

    Creates a linear gradient with defined by an imaginary line which implies the direction of the gradient. -Once the gradient is created colors can be inserted using the addColorStop method.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    x - - -number - - - -

    The x axis of the coordinate for the gradients starting point.

    y - - -number - - - -

    The y axis of the coordinate for the gradients starting point.

    width - - -number - - - -

    The width of the gradient.

    height - - -number - - - -

    The height of the gradient.

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

    The Linear Gradient.

    -
    - - - -
    -
    - Type -
    -
    - -CanvasGradient - - -
    -
    - - - - - -
    - - - -
    -

    createRadialGradient(x0, y0, r0, x1, y1, r1) → {CanvasGradient}

    - - -
    -
    - - -
    -

    Creates a radial gradient.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    x0 - - -number - - - -
    y0 - - -number - - - -
    r0 - - -number - - - -
    x1 - - -number - - - -
    y1 - - -number - - - -
    r1 - - -number - - - -
    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    The Radial Gradient.

    -
    - - - -
    -
    - Type -
    -
    - -CanvasGradient - - -
    -
    - - - - - -
    - - - -
    -

    dc()

    - - -
    -
    - - -
    -

    Shortcut to drawCircle.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    de()

    - - -
    -
    - - -
    -

    Shortcut to drawEllipse.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    dp()

    - - -
    -
    - - -
    -

    Shortcut to drawPolyStar.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    dr()

    - - -
    -
    - - -
    -

    Shortcut to rect.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    ef()

    - - -
    -
    - - -
    -

    Shortcut to endFill.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    ellipse(x, y, w, h) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Draws an ellipse (oval) with a specified width (w) and height (h).

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    x - - -number - - - -

    x coordinate center point of ellipse.

    y - - -number - - - -

    y coordinate center point of ellipse.

    w - - -number - - - -

    height (horizontal diameter) of ellipse. The horizontal radius will be half of this number.

    h - - -number - - - -

    width (vertical diameter) of ellipse. The vertical radius will be half of this number.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    es()

    - - -
    -
    - - -
    -

    Shortcut to endStroke.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    f()

    - - -
    -
    - - -
    -

    Shortcut to beginFill.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    fill() → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Fills the subpaths with the current fill style.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    fillRect(x, y, width, height) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Draws a filled rectangle at (x, y) position whose size is determined by width and height.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    x - - -number - - - -

    The x axis of the coordinate for the rectangle starting point.

    y - - -number - - - -

    The y axis of the coordinate for the rectangle starting point.

    width - - -number - - - -

    The rectangles width.

    height - - -number - - - -

    The rectangles height.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    fillStyle(color) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Sets the fill style.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    color - - -string - - - -

    The fill color value in CSS format: #RRGGBB or rgba(r,g,b,a)

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    font(font) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Sets the font.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    font - - -DOMString - - - -

    The font to be used for any text rendering. Default value 10px sans-serif.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - -
    @@ -7211,7 +2379,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -7375,7 +2543,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -7516,7 +2684,7 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    Source:
    @@ -7567,300 +2735,13 @@ Once the gradient is created colors can be inserted using the addColorStop metho
    -

    globalAlpha(alpha) → {Phaser.BitmapData}

    +

    refreshBuffer()

    -
    -

    Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque).

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    alpha - - -number - - - -

    Alpha value that is applied to shapes and images before they are composited onto the canvas. Default 1.0 (opaque).

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    globalCompositeOperation(operation) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    With globalAlpha applied this sets how shapes and images are drawn onto the existing bitmap. Possible values: source-atop, source-in, source-out, -source-over (default), destination-atop, destination-in, destination-out, destination-over, lighter, darker, copy and xor.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    operation - - -DOMString - - - -

    The composite operation to apply.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    lf()

    - - -
    -
    - - -
    -

    Shortcut to beginLinearGradientFill.

    -
    - @@ -7891,7 +2772,7 @@ source-over (default), destination-atop, destination-in, destination-out, destin
    Source:
    @@ -7914,1873 +2795,6 @@ source-over (default), destination-atop, destination-in, destination-out, destin - - - - -
    -

    lineCap(style) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Type of endings on the end of lines. Possible values: butt (default), round, square.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    style - - -DOMString - - - -

    Possible values: butt (default), round, square

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    lineDashOffset(offset) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Specifies where to start a dasharray on a line.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    offset - - -number - - - -

    Specifies where to start a dasharray on a line.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    lineJoin(join) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Defines the type of corners where two lines meet. Possible values: round, bevel, miter (default)

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    join - - -DOMString - - - -

    Possible values: round, bevel, miter (default)

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    lineTo(x, y) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Connects the last point in the subpath to the x, y coordinates with a straight line.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    x - - -number - - - -

    The x axis of the coordinate for the end of the line.

    y - - -number - - - -

    The y axis of the coordinate for the end of the line.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    lineWidth(width) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Width of lines. Default 1.0

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    width - - -number - - - -

    Width of lines. Default 1.0

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    ls()

    - - -
    -
    - - -
    -

    Shortcut to beginLinearGradientStroke.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    miterLimit(limit) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Default 10.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    limit - - -number - - - -

    Default 10.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    moveTo(x, y) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Moves the starting point of a new subpath to the (x, y) coordinates.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    x - - -number - - - -

    The x axis of the point.

    y - - -number - - - -

    The y axis of the point.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    mt()

    - - -
    -
    - - -
    -

    Shortcut to moveTo.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    mt()

    - - -
    -
    - - -
    -

    Shortcut to lineTo.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    qt()

    - - -
    -
    - - -
    -

    Shortcut to quadraticCurveTo.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    quadraticCurveTo(cpx, cpy, x, y) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Draws a quadratic curve from the current drawing point to (x, y) using the control point (cpx, cpy).

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    cpx - - -Number - - - -

    The x axis of the control point.

    cpy - - -Number - - - -

    The y axis of the control point.

    x - - -Number - - - -

    The x axis of the ending point.

    y - - -Number - - - -

    The y axis of the ending point.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    r()

    - - -
    -
    - - -
    -

    Shortcut to rect.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    rc()

    - - -
    -
    - - -
    -

    Shortcut to drawRoundRectComplex.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    rect(x, y, width, height) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Draws a rectangle at (x, y) position whose size is determined by width and height.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    x - - -number - - - -

    The x axis of the coordinate for the rectangle starting point.

    y - - -number - - - -

    The y axis of the coordinate for the rectangle starting point.

    width - - -number - - - -

    The rectangles width.

    height - - -number - - - -

    The rectangles height.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - -
    @@ -9828,7 +2842,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -9856,7 +2870,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    -

    restore() → {Phaser.BitmapData}

    +

    resize()

    @@ -9864,7 +2878,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    -

    Restores the drawing style state to the last element on the 'state stack' saved by save().

    +

    Resizes the BitmapData.

    @@ -9897,7 +2911,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -9918,790 +2932,6 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw -
    Returns:
    - - -
    -

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - - - - - -
    -

    rf()

    - - -
    -
    - - -
    -

    Shortcut to beginRadialGradientFill.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    rotate(angle) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Rotates the drawing context values by r radians.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    angle - - -number - - - -

    The angle of rotation given in radians.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    rr()

    - - -
    -
    - - -
    -

    Shortcut to drawRoundRect.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    rs()

    - - -
    -
    - - -
    -

    Shortcut to beginRadialGradientStroke.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    s()

    - - -
    -
    - - -
    -

    Shortcut to beginStroke.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    save() → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Saves the current drawing style state using a stack so you can revert any change you make to it using restore().

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    scale(x, y) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Scales the current drawing context.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    x - - -number - - - -
    y - - -number - - - -
    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    scrollPathIntoView() → {Phaser.BitmapData}

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - -
    @@ -10891,7 +3121,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -11124,7 +3354,7 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw
    Source:
    @@ -11147,839 +3377,6 @@ This is called automatically if the BitmapData is being used by a Sprite, otherw - - - - -
    -

    setStrokeStyle(thickness, caps, joints, miterLimit, ignoreScale) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Sets the stroke style for the current sub-path. Like all drawing methods, this can be chained, so you can define -the stroke style and color in a single line of code like so:

    -
     ```myGraphics.setStrokeStyle(8,"round").beginStroke("#F00");```
    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDefaultDescription
    thickness - - -number - - - - - - - - - - - -

    The width of the stroke.

    caps - - -string -| - -number - - - - - - <optional>
    - - - - - -
    - - 0 - -

    Indicates the type of caps to use at the end of lines. One of butt, round, or square. Defaults to "butt". Also accepts the values 0 (butt), 1 (round), and 2 (square) for use with he tiny API.

    joints - - -string -| - -number - - - - - - <optional>
    - - - - - -
    - - 0 - -

    Specifies the type of joints that should be used where two lines meet. One of bevel, round, or miter. Defaults to "miter". Also accepts the values 0 (miter), 1 (round), and 2 (bevel) for use with the tiny API.

    miterLimit - - -number - - - - - - <optional>
    - - - - - -
    - - 10 - -

    If joints is set to "miter", then you can specify a miter limit ratio which controls at what point a mitered joint will be clipped.

    ignoreScale - - -boolean - - - - - - <optional>
    - - - - - -
    - - false - -

    If true, the stroke will be drawn at the specified thickness regardless of active transformations.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    ss()

    - - -
    -
    - - -
    -

    Shortcut to setStrokeStyle.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    stroke() → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Strokes the subpaths with the current stroke style.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    strokeRect(x, y, width, height) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    x - - -number - - - -

    The x axis for the starting point of the rectangle.

    y - - -number - - - -

    The y axis for the starting point of the rectangle.

    width - - -number - - - -

    The rectangles width.

    height - - -number - - - -

    The rectangles height.

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - - -
    - - - -
    -

    strokeStyle(style) → {Phaser.BitmapData}

    - - -
    -
    - - -
    -

    Color or style to use for the lines around shapes. Default #000 (black).

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    style - - -string - - - -

    Color or style to use for the lines around shapes. Default #000 (black).

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

    The BitmapData instance this method was called on.

    -
    - - - -
    -
    - Type -
    -
    - -Phaser.BitmapData - - -
    -
    - - - - -
    @@ -12008,7 +3405,7 @@ the stroke style and color in a single line of code like so:

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:18 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.BitmapFont.html b/docs/Phaser.BitmapFont.html new file mode 100644 index 00000000..349dcde7 --- /dev/null +++ b/docs/Phaser.BitmapFont.html @@ -0,0 +1,4772 @@ + + + + + + Phaser Class: BitmapFont + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: BitmapFont

    +
    + +
    +

    + Phaser. + + BitmapFont +

    + +

    Phaser.BitmapFont

    + +
    + +
    +
    + + + + +
    +

    new BitmapFont(game, key, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset)

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

    Current game instance.

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

    The font set graphic set as stored in the Game.Cache.

    characterWidth + + +number + + + + + + + + + + + +

    The width of each character in the font set.

    characterHeight + + +number + + + + + + + + + + + +

    The height of each character in the font set.

    chars + + +string + + + + + + + + + + + +

    The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements.

    charsPerRow + + +number + + + + + + + + + + + +

    The number of characters per row in the font set.

    xSpacing + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    If the characters in the font set have horizontal spacing between them set the required amount here.

    ySpacing + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    If the characters in the font set have vertical spacing between them set the required amount here.

    xOffset + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.

    yOffset + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.

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

    Extends

    + + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    <static, constant> ALIGN_CENTER :string

    + + +
    +
    + +
    +

    Align each line of multi-line text in the center.

    +
    + + + +
    Type:
    +
      +
    • + +string + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> ALIGN_LEFT :string

    + + +
    +
    + +
    +

    Align each line of multi-line text to the left.

    +
    + + + +
    Type:
    +
      +
    • + +string + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> ALIGN_RIGHT :string

    + + +
    +
    + +
    +

    Align each line of multi-line text to the right.

    +
    + + + +
    Type:
    +
      +
    • + +string + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXT_SET1 :string

    + + +
    +
    + +
    +

    Text Set 1 = !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~

    +
    + + + +
    Type:
    +
      +
    • + +string + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXT_SET2 :string

    + + +
    +
    + +
    +

    Text Set 2 = !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ

    +
    + + + +
    Type:
    +
      +
    • + +string + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXT_SET3 :string

    + + +
    +
    + +
    +

    Text Set 3 = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

    +
    + + + +
    Type:
    +
      +
    • + +string + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXT_SET4 :string

    + + +
    +
    + +
    +

    Text Set 4 = ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789

    +
    + + + +
    Type:
    +
      +
    • + +string + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXT_SET5 :string

    + + +
    +
    + +
    +

    Text Set 5 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789

    +
    + + + +
    Type:
    +
      +
    • + +string + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXT_SET6 :string

    + + +
    +
    + +
    +

    Text Set 6 = ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.'

    +
    + + + +
    Type:
    +
      +
    • + +string + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXT_SET7 :string

    + + +
    +
    + +
    +

    Text Set 7 = AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39

    +
    + + + +
    Type:
    +
      +
    • + +string + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXT_SET8 :string

    + + +
    +
    + +
    +

    Text Set 8 = 0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ

    +
    + + + +
    Type:
    +
      +
    • + +string + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXT_SET9 :string

    + + +
    +
    + +
    +

    Text Set 9 = ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!

    +
    + + + +
    Type:
    +
      +
    • + +string + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXT_SET10 :string

    + + +
    +
    + +
    +

    Text Set 10 = ABCDEFGHIJKLMNOPQRSTUVWXYZ

    +
    + + + +
    Type:
    +
      +
    • + +string + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXT_SET11 :string

    + + +
    +
    + +
    +

    Text Set 11 = ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789

    +
    + + + +
    Type:
    +
      +
    • + +string + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    align

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    align + + +string + + + +

    Alignment of the text when multiLine = true or a fixedWidth is set. Set to BitmapFont.ALIGN_LEFT (default), BitmapFont.ALIGN_RIGHT or BitmapFont.ALIGN_CENTER.

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

    autoUpperCase

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    autoUpperCase + + +boolean + + + +

    Automatically convert any text to upper case. Lots of old bitmap fonts only contain upper-case characters, so the default is true.

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

    characterHeight

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    characterHeight + + +number + + + +

    The height of each character in the font set.

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

    characterPerRow

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    characterPerRow + + +number + + + +

    The number of characters per row in the font set.

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

    characterSpacingX

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    characterSpacingX + + +number + + + +

    If the characters in the font set have horizontal spacing between them set the required amount here.

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

    characterSpacingY

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    characterSpacingY + + +number + + + +

    If the characters in the font set have vertical spacing between them set the required amount here.

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

    characterWidth

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    characterWidth + + +number + + + +

    The width of each character in the font set.

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

    customSpacingX

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    customSpacingX + + +number + + + +

    Adds horizontal spacing between each character of the font, in pixels.

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

    customSpacingY

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    customSpacingY + + +number + + + +

    Adds vertical spacing between each line of multi-line text, set in pixels.

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

    fixedWidth

    + + +
    +
    + +
    +

    If you need this BitmapFont image to have a fixed width you can set the width in this value. +If text is wider than the width specified it will be cropped off.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    fixedWidth + + +number + + + +
    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    fontSet

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    fontSet + + +HTMLImage + + + +

    A reference to the image stored in the Game.Cache that contains the font.

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

    game

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

    A reference to the currently running game.

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

    key

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

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

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

    multiLine

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    multiLine + + +boolean + + + +

    If set to true all carriage-returns in text will form new lines (see align). If false the font will only contain one single line of text (the default)

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

    offsetX

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    offsetX + + +number + + + +

    If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.

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

    offsetY

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    offsetY + + +number + + + +

    If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.

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

    type

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

    Base Phaser object type.

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

    Methods

    + +
    + +
    +

    buildBitmapFontText()

    + + +
    +
    + + +
    +

    Updates the BitmapData of the Sprite with the text

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

    buildBitmapFontText(line, x, y, customSpacingX)

    + + +
    +
    + + +
    +

    Internal function that takes a single line of text (2nd parameter) and pastes it into the BitmapData at the given coordinates. +Used by getLine and getMultiLine

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    line + + +string + + + +

    The single line of text to paste.

    x + + +number + + + +

    The x coordinate.

    y + + +number + + + +

    The y coordinate.

    customSpacingX + + +number + + + +

    Custom X spacing.

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

    getLongestLine() → {number}

    + + +
    +
    + + +
    +

    Works out the longest line of text in _text and returns its length

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

    The length of the longest line of text.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    <protected> removeUnsupportedCharacters(stripCR) → {string}

    + + +
    +
    + + +
    +

    Internal helper function that removes all unsupported characters from the _text String, leaving only characters contained in the font set.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    stripCR + + +boolean + + + + + + <optional>
    + + + + + +
    + + true + +

    Should it strip carriage returns as well?

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

    A clean version of the string.

    +
    + + + +
    +
    + Type +
    +
    + +string + + +
    +
    + + + + + +
    + + + +
    +

    resize()

    + + +
    +
    + + +
    +

    Over rides the default PIXI.RenderTexture resize event as we need our baseTexture resized as well.

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

    setFixedWidth(width, lineAlignment)

    + + +
    +
    + + +
    +

    If you need this FlxSprite to have a fixed width and custom alignment you can set the width here.<br> +If text is wider than the width specified it will be cropped off.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    width + + +number + + + + + + + + + + + +

    Width in pixels of this BitmapFont. Set to zero to disable and re-enable automatic resizing.

    lineAlignment + + +string + + + + + + <optional>
    + + + + + +
    + + 'left' + +

    Align the text within this width. Set to BitmapFont.ALIGN_LEFT (default), BitmapFont.ALIGN_RIGHT or BitmapFont.ALIGN_CENTER.

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

    setText(content, multiLine, characterSpacing, lineSpacing, lineAlignment, allowLowerCase)

    + + +
    +
    + + +
    +

    A helper function that quickly sets lots of variables at once, and then updates the text.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    content + + +string + + + + + + + + + + + +

    The text of this sprite.

    multiLine + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    Set to true if you want to support carriage-returns in the text and create a multi-line sprite instead of a single line.

    characterSpacing + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    To add horizontal spacing between each character specify the amount in pixels.

    lineSpacing + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    To add vertical spacing between each line of text, set the amount in pixels.

    lineAlignment + + +string + + + + + + <optional>
    + + + + + +
    + + 'left' + +

    Align each line of multi-line text. Set to BitmapFont.ALIGN_LEFT, BitmapFont.ALIGN_RIGHT or BitmapFont.ALIGN_CENTER.

    allowLowerCase + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    Lots of bitmap font sets only include upper-case characters, if yours needs to support lower case then set this to true.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2014 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.3.0-dev + on Tue Feb 18 2014 03:01:18 GMT-0000 (GMT) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Phaser.BitmapText.html b/docs/Phaser.BitmapText.html index 039748e8..7fd23600 100644 --- a/docs/Phaser.BitmapText.html +++ b/docs/Phaser.BitmapText.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -456,8 +464,9 @@

    BitmapText objects work by taking a texture file and an XML file that describes the font layout.

    -

    On Windows you can use the free app BMFont: http://www.angelcode.com/products/bmfont/

    -

    On OS X we recommend Glyph Designer: http://www.71squared.com/en/glyphdesigner

    +

    On Windows you can use the free app BMFont: http://www.angelcode.com/products/bmfont/ +On OS X we recommend Glyph Designer: http://www.71squared.com/en/glyphdesigner +For Web there is the great Littera: http://kvazars.com/littera/

    @@ -468,7 +477,7 @@
    -

    new BitmapText(game, x, y, text, style)

    +

    new BitmapText(game, x, y, font, text, size)

    @@ -498,8 +507,12 @@ Type + Argument + + Default + Description @@ -523,7 +536,19 @@ + + + + + + + + + + + +

    A reference to the currently running game.

    @@ -546,7 +571,19 @@ + + + + + + + + + + + +

    X position of the new bitmapText object.

    @@ -569,7 +606,19 @@ + + + + + + + + + + + +

    Y position of the new bitmapText object.

    @@ -577,6 +626,41 @@ + + + font + + + + + +string + + + + + + + + + + + + + + + + + + + + + +

    The key of the BitmapFont as stored in Game.Cache.

    + + + + text @@ -592,33 +676,65 @@ + + + <optional>
    + + + + + -

    The actual text that will be written.

    + + + + '' + + + + +

    The actual text that will be rendered. Can be set later via BitmapText.text.

    - style + size -object +number + + + <optional>
    + + + + + -

    The style object containing style attributes like font, font size , etc.

    + + + + 32 + + + + +

    The size the font will be rendered in, in pixels.

    @@ -650,7 +766,7 @@
    Source:
    @@ -694,7 +810,7 @@
    -

    alive

    +

    align

    @@ -733,13 +849,13 @@ - alive + align -boolean +string @@ -749,119 +865,7 @@ -

    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:
    -
    - - - - - - - - - - - - - - - -
    -

    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:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -890,7 +894,7 @@ Setting the anchor to 1,1 would mean the textures origin points will be the bott
    Source:
    @@ -915,7 +919,7 @@ Setting the anchor to 1,1 would mean the textures origin points will be the bott
    -

    Indicates the rotation of the BitmapText, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. +

    Indicates the rotation of the Text, 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.

    @@ -998,7 +1002,211 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    + + + + + + + + + + + + + + + +
    +

    cameraOffset

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + +
    NameTypeDescription
    anchor - - -Phaser.Point - - - -

    The anchor around which rotation and scaling takes place.

    Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    cameraOffset + + +Phaser.Point + + + +

    If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.

    +
    + + + + + + + + + + + + + + + + + + + + +
    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:
    +
    @@ -1103,7 +1311,319 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    fixedToCamera

    + + +
    +
    + +
    +

    An BitmapText that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in BitmapText.cameraOffset. +Note that the cameraOffset values are in addition to any parent in the display list. +So if this BitmapText was in a Group that has x: 200, then this will be added to the cameraOffset.x

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

    Set to true to fix this BitmapText to the Camera at its current world coordinates.

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

    font

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    font + + +string + + + +

    The font the text will be rendered in, i.e. 'Arial'. Must be loaded in the browser before use.

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

    fontSize

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    fontSize + + +number + + + +

    The size of the font in pixels.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1205,7 +1725,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    @@ -1223,7 +1743,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

    group

    +

    input

    @@ -1262,13 +1782,16 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati - group + input -Phaser.Group +Phaser.InputHandler +| + +null @@ -1278,7 +1801,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -

    The parent Group of this BitmapText.

    +

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

    @@ -1307,7 +1830,114 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    inputEnabled

    + + +
    +
    + +
    +

    By default a Text object 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:
    +
    @@ -1409,7 +2039,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    @@ -1427,7 +2057,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

    scale

    +

    text

    @@ -1466,13 +2096,13 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati - scale + text -Phaser.Point +string @@ -1482,7 +2112,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -

    The scale of the object 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.

    +

    Set this value to update the text in this sprite. Carriage returns are automatically stripped out if multiLine is false. Text is converted to upper case if autoUpperCase is true.

    @@ -1511,7 +2141,215 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    text

    + + +
    +
    + +
    +

    The text string to be displayed by this Text object, taking into account the style settings.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    text + + +string + + + +

    The text string to be displayed by this Text object, taking into account the style settings.

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

    tint

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    tint + + +number + + + +

    The tint applied to the BitmapText. This is a hex value. Set to white to disable (0xFFFFFF)

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1613,7 +2451,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    @@ -1631,16 +2469,12 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

    x

    +

    world

    -
    -

    The x coordinate of this object in world space.

    -
    - @@ -1674,13 +2508,13 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati - x + world -number +Phaser.Point @@ -1690,7 +2524,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -

    The x coordinate of this object in world space.

    +

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

    @@ -1719,113 +2553,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    - - - - - - - -
    - - - -
    - - - -
    -

    y

    - - -
    -
    - -
    -

    The y coordinate of this object in world space.

    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    y - - -number - - - -

    The y coordinate of this object in world space.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -1849,7 +2577,72 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

    update()

    +

    destroy()

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

    postUpdate()

    @@ -1857,7 +2650,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

    Automatically called by World.update

    +

    Automatically called by World.postUpdate.

    @@ -1890,7 +2683,145 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    preUpdate()

    + + +
    +
    + + +
    +

    Automatically called by World.preUpdate.

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

    update()

    + + +
    +
    + + +
    +

    Override and use this function in your own custom objects to handle any update requirements you may have.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1941,7 +2872,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 Sat Feb 08 2014 07:19:42 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:18 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Button.html b/docs/Phaser.Button.html index 2dfbb336..9510b967 100644 --- a/docs/Phaser.Button.html +++ b/docs/Phaser.Button.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -981,9 +989,9 @@
    -

    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. +

    Indicates the rotation of the Image, 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.

    +If you wish to work in radians instead of degrees use the property Image.rotation instead. Working in radians is also a little faster as it doesn't have to convert the angle.

    @@ -1035,7 +1043,7 @@ If you wish to work in radians instead of degrees use the rotation property inst -

    The angle of this Button in degrees.

    +

    The angle of this Image in degrees.

    @@ -1050,6 +1058,11 @@ If you wish to work in radians instead of degrees use the rotation property inst +
    Inherited From:
    +
    + @@ -1064,7 +1077,7 @@ If you wish to work in radians instead of degrees use the rotation property inst
    Source:
    @@ -1089,7 +1102,7 @@ If you wish to work in radians instead of degrees use the rotation property inst
    -

    Should this Sprite be automatically culled if out of range of the camera? +

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

    @@ -1143,7 +1156,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun -

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

    +

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

    @@ -1180,7 +1193,114 @@ Be advised this is quite an expensive operation, as it has to calculate the boun
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    cameraOffset

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

    If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    @@ -1291,7 +1411,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun
    Source:
    @@ -1402,7 +1522,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun
    Source:
    @@ -1513,7 +1633,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun
    Source:
    @@ -1586,7 +1706,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun -

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

    +

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

    @@ -1693,7 +1813,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun -

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

    +

    If exists = false then the Image isn't updated by the core game loop.

    @@ -1755,8 +1875,9 @@ Be advised this is quite an expensive operation, as it has to calculate the boun
    -

    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.

    +

    An Image that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Image.cameraOffset. +Note that the cameraOffset values are in addition to any parent in the display list. +So if this Image was in a Group that has x: 200, then this will be added to the cameraOffset.x

    @@ -1808,7 +1929,7 @@ Note that if this Image is a child of a display object that has changed its posi -

    Fixes this Sprite to the Camera.

    +

    Set to true to fix this Image to the Camera at its current world coordinates.

    @@ -1838,14 +1959,11 @@ Note that if this Image is a child of a display object that has changed its posi -
    Default Value:
    -
    • false
    -
    Source:
    @@ -2061,7 +2179,7 @@ Note that if this Image is a child of a display object that has changed its posi
    Source:
    @@ -2168,7 +2286,7 @@ Note that if this Image is a child of a display object that has changed its posi
    Source:
    @@ -2488,7 +2606,7 @@ Note that if this Image is a child of a display object that has changed its posi
    Source:
    @@ -2598,7 +2716,7 @@ Note that if this Image is a child of a display object that has changed its posi
    Source:
    @@ -2710,7 +2828,7 @@ activated for this object and it will then start to process click/touch events a
    Source:
    @@ -2821,7 +2939,7 @@ activated for this object and it will then start to process click/touch events a
    Source:
    @@ -2903,7 +3021,7 @@ activated for this object and it will then start to process click/touch events a -

    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 is the image or 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.

    @@ -3010,7 +3128,7 @@ activated for this object and it will then start to process click/touch events a -

    The user defined name given to this Sprite.

    +

    The user defined name given to this Image.

    @@ -4387,7 +4505,7 @@ activated for this object and it will then start to process click/touch events a
    Source:
    @@ -4562,7 +4680,7 @@ activated for this object and it will then start to process click/touch events a -

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

    +

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

    @@ -4596,7 +4714,7 @@ activated for this object and it will then start to process click/touch events a
    Source:
    @@ -4628,7 +4746,7 @@ activated for this object and it will then start to process click/touch events a
    -

    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 +

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

    @@ -4667,7 +4785,7 @@ bought to the top of that Group, not the entire display list.

    Source:
    @@ -4883,7 +5001,7 @@ Cropping takes place from the top-left of the Image and can be modified in real-
    Source:
    @@ -4919,7 +5037,7 @@ Cropping takes place from the top-left of the Image and can be modified in real-
    -

    Destroys the Sprite. This removes it from its parent group, destroys the input, event and animation handlers if present +

    Destroys the Image. 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.

    @@ -4958,7 +5076,7 @@ and nulls its reference to game, freeing it up for garbage collection.

    Source:
    @@ -4994,10 +5112,10 @@ and nulls its reference to game, freeing it up for garbage collection.

    -

    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.

    +

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

    @@ -5035,7 +5153,7 @@ If you don't need this Sprite any more you should call Sprite.destroy instead.Source:
    @@ -5094,7 +5212,7 @@ If you don't need this Sprite any more you should call Sprite.destroy instead. -

    Changes the Texture the Sprite is using entirely. The old texture is removed and the new one is referenced or fetched from the Cache. +

    Changes the Texture the Image 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.

    @@ -5154,7 +5272,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion -

    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 is the image or 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.

    @@ -5180,7 +5298,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion -

    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.

    +

    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.

    @@ -5217,7 +5335,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
    Source:
    @@ -5855,7 +5973,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
    Source:
    @@ -5929,7 +6047,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
    Source:
    @@ -5965,7 +6083,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
    -

    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.

    +

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

    @@ -6015,7 +6133,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion -

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

    +

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

    @@ -6038,7 +6156,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion -

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

    +

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

    @@ -6075,7 +6193,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
    Source:
    @@ -6134,9 +6252,9 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
    -

    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.

    +

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

    @@ -6174,7 +6292,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    @@ -7586,6 +7704,80 @@ Call this function with no parameters at all to reset all sounds on this Button. +
    + + + +
    +

    update()

    + + +
    +
    + + +
    +

    Override and use this function in your own custom objects to handle any update requirements you may have.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + +
    @@ -7614,7 +7806,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 Sat Feb 08 2014 07:19:42 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:18 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Cache.html b/docs/Phaser.Cache.html index 83bec0aa..a72c74ef 100644 --- a/docs/Phaser.Cache.html +++ b/docs/Phaser.Cache.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -599,6 +607,606 @@
    +
    +

    <static, constant> BINARY :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> BITMAPDATA :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> BITMAPFONT :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> CANVAS :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> IMAGE :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> PHYSICS :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> SOUND :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXT :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TEXTURE :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    <static, constant> TILEMAP :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + +

    game

    @@ -786,7 +1394,7 @@
    Source:
    @@ -923,7 +1531,7 @@
    Source:
    @@ -1064,7 +1672,7 @@
    Source:
    @@ -1115,7 +1723,7 @@
    -

    addBitmapFont(key, url, data, xmlData)

    +

    addBitmapFont(key, texture)

    @@ -1123,7 +1731,7 @@
    -

    Add a new Bitmap Font.

    +

    Add a Phaser.BitmapFont in to the cache.

    @@ -1180,13 +1788,13 @@ - url + texture -string +Phaser.BitmapFont @@ -1196,53 +1804,7 @@ -

    URL of this font xml file.

    - - - - - - - data - - - - - -object - - - - - - - - - -

    Extra font data.

    - - - - - - - xmlData - - - - - -object - - - - - - - - - -

    Texture atlas frames data.

    +

    The BitmapFont object to be stored. This can be applied to any Image/Sprite as a texture.

    @@ -1274,7 +1836,324 @@
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + + + + + +
    +

    addBitmapFont(key, url, data, xmlData, xSpacing, ySpacing)

    + + +
    +
    + + +
    +

    Add a new Bitmap Font to the Cache.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    key + + +string + + + + + + + + + + + +

    The unique key by which you will reference this object.

    url + + +string + + + + + + + + + + + +

    URL of this font xml file.

    data + + +object + + + + + + + + + + + +

    Extra font data.

    xmlData + + +object + + + + + + + + + + + +

    Texture atlas frames data.

    xSpacing + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    If you'd like to add additional horizontal spacing between the characters then set the pixel value here.

    ySpacing + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    If you'd like to add additional vertical spacing between the lines then set the pixel value here.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1438,7 +2317,7 @@
    Source:
    @@ -1466,7 +2345,7 @@
    -

    addDefaultImage()

    +

    <protected> addDefaultImage()

    @@ -1507,7 +2386,7 @@
    Source:
    @@ -1671,7 +2550,7 @@
    Source:
    @@ -1699,7 +2578,7 @@
    -

    addMissingImage()

    +

    <protected> addMissingImage()

    @@ -1740,7 +2619,7 @@
    Source:
    @@ -1881,7 +2760,7 @@
    Source:
    @@ -2091,7 +2970,7 @@
    Source:
    @@ -2482,7 +3361,7 @@
    Source:
    @@ -2646,7 +3525,7 @@
    Source:
    @@ -2682,7 +3561,7 @@
    -

    Add a new texture atlas.

    +

    Add a new texture atlas to the Cache.

    @@ -2856,7 +3735,7 @@
    Source:
    @@ -2892,7 +3771,7 @@
    -

    Add a new tilemap.

    +

    Add a new tilemap to the Cache.

    @@ -3043,7 +3922,194 @@
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    addTilemap(key, url, JSONData, format)

    + + +
    +
    + + +
    +

    Add a new physics data object to the Cache.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    The unique key by which you will reference this object.

    url + + +string + + + +

    URL of the physics json data.

    JSONData + + +object + + + +

    The physics data object (a JSON file).

    format + + +number + + + +

    The format of the physics data.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -3161,7 +4227,7 @@
    Source:
    @@ -3325,7 +4391,7 @@
    Source:
    @@ -3394,7 +4460,7 @@
    Source:
    @@ -3512,7 +4578,7 @@
    Source:
    @@ -3653,7 +4719,7 @@
    Source:
    @@ -3699,6 +4765,147 @@ +
    + + + +
    +

    getBitmapFont(key) → {Phaser.BitmapFont}

    + + +
    +
    + + +
    +

    Get a BitmapFont object from the cache by its key.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Asset key of the BitmapFont object to retrieve from the Cache.

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

    The requested BitmapFont object if found, or null if not.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.BitmapFont + + +
    +
    + + + + +
    @@ -3794,7 +5001,7 @@
    Source:
    @@ -3935,7 +5142,7 @@
    Source:
    @@ -4076,7 +5283,7 @@
    Source:
    @@ -4217,7 +5424,7 @@
    Source:
    @@ -4358,7 +5565,7 @@
    Source:
    @@ -4499,7 +5706,7 @@
    Source:
    @@ -4550,7 +5757,7 @@
    -

    getImageKeys() → {Array}

    +

    getKeys(type) → {Array}

    @@ -4558,100 +5765,7 @@
    -

    Returns an array containing all of the keys of Images in the Cache.

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

    The string based keys in the Cache.

    -
    - - - -
    -
    - Type -
    -
    - -Array - - -
    -
    - - - - - - - - - -
    -

    getKeys(array) → {Array}

    - - -
    -
    - - -
    -

    Get the cache keys from a given array of objects. -Normally you don't call this directly but instead use getImageKeys, getSoundKeys, etc.

    +

    Gets all keys used by the Cache for the given data type.

    @@ -4673,8 +5787,12 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys Type + Argument + + Default + Description @@ -4685,23 +5803,39 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys - array + type -Array +number + + + <optional>
    + + + + + -

    An array of items to return the keys for.

    + + + + Phaser.Cache.IMAGE + + + + +

    The type of Cache keys you wish to get. Can be Cache.CANVAS, Cache.IMAGE, Cache.SOUND, etc.

    @@ -4733,7 +5867,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    @@ -4779,6 +5913,202 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys + + + + +
    +

    getPhysicsData(key, object) → {object}

    + + +
    +
    + + +
    +

    Get a physics data object from the cache by its key. You can get either the entire data set or just a single object from it.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    key + + +string + + + + + + + + + + + +

    Asset key of the physics data object to retrieve from the Cache.

    object + + +string + + + + + + <optional>
    + + + + + +
    + + null + +

    If specified it will return just the physics object that is part of the given key, if null it will return them all.

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

    The requested physics object data if found.

    +
    + + + +
    +
    + Type +
    +
    + +object + + +
    +
    + + + + +
    @@ -4874,7 +6204,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    @@ -5015,7 +6345,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    @@ -5061,98 +6391,6 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys - - - - -
    -

    getSoundKeys() → {Array}

    - - -
    -
    - - -
    -

    Returns an array containing all of the keys of Sounds in the Cache.

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

    The string based keys in the Cache.

    -
    - - - -
    -
    - Type -
    -
    - -Array - - -
    -
    - - - - -
    @@ -5248,7 +6486,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    @@ -5294,98 +6532,6 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys - - - - -
    -

    getTextKeys() → {Array}

    - - -
    -
    - - -
    -

    Returns an array containing all of the keys of Text Files in the Cache.

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

    The string based keys in the Cache.

    -
    - - - -
    -
    - Type -
    -
    - -Array - - -
    -
    - - - - -
    @@ -5481,7 +6627,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    @@ -5622,7 +6768,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    @@ -5763,7 +6909,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    @@ -5904,7 +7050,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    @@ -6045,7 +7191,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    @@ -6186,7 +7332,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    @@ -6327,7 +7473,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    @@ -6445,7 +7591,361 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    removeBinary(key)

    + + +
    +
    + + +
    +

    Removes a binary file from the cache.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the asset you want to remove.

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

    removeBitmapData(key)

    + + +
    +
    + + +
    +

    Removes a bitmap data from the cache.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the asset you want to remove.

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

    removeBitmapFont(key)

    + + +
    +
    + + +
    +

    Removes a bitmap font from the cache.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the asset you want to remove.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -6563,7 +8063,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    @@ -6681,7 +8181,125 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    removePhysics(key)

    + + +
    +
    + + +
    +

    Removes a physics data file from the cache.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the asset you want to remove.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -6799,7 +8417,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    @@ -6917,7 +8535,266 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    removeTilemap(key)

    + + +
    +
    + + +
    +

    Removes a tilemap from the cache.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    Key of the asset you want to remove.

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

    updateFrameData(key, frameData)

    + + +
    +
    + + +
    +

    Replaces a set of frameData with a new Phaser.FrameData object.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    key + + +string + + + +

    The unique key by which you will reference this object.

    frameData + + +number + + + +

    The new FrameData.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -7035,7 +8912,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys
    Source:
    @@ -7086,7 +8963,7 @@ Normally you don't call this directly but instead use getImageKeys, getSoundKeys Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:42 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:18 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Camera.html b/docs/Phaser.Camera.html index c06156fd..90ef22ed 100644 --- a/docs/Phaser.Camera.html +++ b/docs/Phaser.Camera.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1560,7 +1568,7 @@ at all then set this to null. The values can be anything and are in World coordi
    Source:
    @@ -2192,7 +2200,7 @@ Objects outside of this view are not rendered if set to camera cull.

    Source:
    @@ -2400,7 +2408,7 @@ Objects outside of this view are not rendered if set to camera cull.

    Source:
    @@ -2506,7 +2514,7 @@ Objects outside of this view are not rendered if set to camera cull.

    Source:
    @@ -3014,6 +3022,75 @@ Objects outside of this view are not rendered if set to camera cull.

    +
    + + + +
    +

    reset()

    + + +
    +
    + + +
    +

    Resets the camera back to 0,0 and un-follows any object it may have been tracking.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + +
    @@ -3463,7 +3540,7 @@ without having to use game.camera.x and game.camera.y.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:42 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:18 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Canvas.html b/docs/Phaser.Canvas.html index 8f38c7e4..69d1ba62 100644 --- a/docs/Phaser.Canvas.html +++ b/docs/Phaser.Canvas.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -2658,7 +2666,7 @@ patchy on earlier browsers, especially on mobile.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:42 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:19 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Circle.html b/docs/Phaser.Circle.html index d3acc07b..b403a745 100644 --- a/docs/Phaser.Circle.html +++ b/docs/Phaser.Circle.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -809,7 +817,7 @@
    Source:
    @@ -915,7 +923,7 @@
    Source:
    @@ -1021,7 +1029,7 @@
    Source:
    @@ -1128,7 +1136,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -1182,7 +1190,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -1288,7 +1296,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -1394,7 +1402,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -1500,7 +1508,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -1923,7 +1931,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -2110,7 +2118,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -2274,7 +2282,7 @@ If set to true it will reset all of the Circle objects properties to 0. A Circle
    Source:
    @@ -2439,7 +2447,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -2603,7 +2611,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -2906,7 +2914,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -3047,7 +3055,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -3211,7 +3219,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -3352,7 +3360,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -3493,7 +3501,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -3678,7 +3686,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -3842,7 +3850,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -3983,7 +3991,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -4262,7 +4270,7 @@ This method checks the radius distances between the two Circle objects to see if
    Source:
    @@ -4336,7 +4344,7 @@ This method checks the radius distances between the two Circle objects to see if Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:42 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:19 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Color.html b/docs/Phaser.Color.html index c71e9133..8e706597 100644 --- a/docs/Phaser.Color.html +++ b/docs/Phaser.Color.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -3645,7 +3653,7 @@ Set the max value to restrict the maximum color used per channel.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:43 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:19 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Device.html b/docs/Phaser.Device.html index 0203c6f8..4d71e4c5 100644 --- a/docs/Phaser.Device.html +++ b/docs/Phaser.Device.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -2181,7 +2189,7 @@ -

    If running in Internet Explorer this will contain the major version number.

    +

    If running in Internet Explorer this will contain the major version number. Beyond IE10 you should use Device.trident and Device.tridentVersion.

    @@ -5905,7 +5913,7 @@
    Source:
    @@ -5997,7 +6005,7 @@
    Source:
    @@ -6071,7 +6079,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:43 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:19 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Back.html b/docs/Phaser.Easing.Back.html index acf5665a..f00a8d8f 100644 --- a/docs/Phaser.Easing.Back.html +++ b/docs/Phaser.Easing.Back.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -997,7 +1005,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:43 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:19 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Bounce.html b/docs/Phaser.Easing.Bounce.html index 3e0a7762..44ca95e5 100644 --- a/docs/Phaser.Easing.Bounce.html +++ b/docs/Phaser.Easing.Bounce.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -997,7 +1005,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:43 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:19 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Circular.html b/docs/Phaser.Easing.Circular.html index 1da13cea..acbbee70 100644 --- a/docs/Phaser.Easing.Circular.html +++ b/docs/Phaser.Easing.Circular.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -997,7 +1005,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:43 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:19 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Cubic.html b/docs/Phaser.Easing.Cubic.html index dadf57d3..59ff4481 100644 --- a/docs/Phaser.Easing.Cubic.html +++ b/docs/Phaser.Easing.Cubic.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -997,7 +1005,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:20 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Elastic.html b/docs/Phaser.Easing.Elastic.html index dcb4f112..66048f26 100644 --- a/docs/Phaser.Easing.Elastic.html +++ b/docs/Phaser.Easing.Elastic.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -997,7 +1005,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:20 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Exponential.html b/docs/Phaser.Easing.Exponential.html index 848cfaf4..20328ba5 100644 --- a/docs/Phaser.Easing.Exponential.html +++ b/docs/Phaser.Easing.Exponential.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -997,7 +1005,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:20 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Linear.html b/docs/Phaser.Easing.Linear.html index e0dd7635..e3343798 100644 --- a/docs/Phaser.Easing.Linear.html +++ b/docs/Phaser.Easing.Linear.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -715,7 +723,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:20 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Quadratic.html b/docs/Phaser.Easing.Quadratic.html index f622e7b6..08520ff0 100644 --- a/docs/Phaser.Easing.Quadratic.html +++ b/docs/Phaser.Easing.Quadratic.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -997,7 +1005,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:20 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Quartic.html b/docs/Phaser.Easing.Quartic.html index 73952cb8..80f34533 100644 --- a/docs/Phaser.Easing.Quartic.html +++ b/docs/Phaser.Easing.Quartic.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -997,7 +1005,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:20 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Quintic.html b/docs/Phaser.Easing.Quintic.html index 740435a7..47098c9e 100644 --- a/docs/Phaser.Easing.Quintic.html +++ b/docs/Phaser.Easing.Quintic.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -997,7 +1005,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:20 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.Sinusoidal.html b/docs/Phaser.Easing.Sinusoidal.html index f84059e8..0e67a9f0 100644 --- a/docs/Phaser.Easing.Sinusoidal.html +++ b/docs/Phaser.Easing.Sinusoidal.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -997,7 +1005,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:44 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:20 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Easing.html b/docs/Phaser.Easing.html index 1181d42f..ba6e934b 100644 --- a/docs/Phaser.Easing.html +++ b/docs/Phaser.Easing.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -607,7 +615,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:43 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:19 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Ellipse.html b/docs/Phaser.Ellipse.html new file mode 100644 index 00000000..757d800f --- /dev/null +++ b/docs/Phaser.Ellipse.html @@ -0,0 +1,2807 @@ + + + + + + Phaser Class: Ellipse + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: Ellipse

    +
    + +
    +

    + Phaser. + + Ellipse +

    + +

    Phaser - Ellipse

    + +
    + +
    +
    + + + + +
    +

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

    + + +
    +
    + + +
    +

    Creates a Ellipse object. A curve on a plane surrounding two focal points.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    x + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    The X coordinate of the upper-left corner of the framing rectangle of this ellipse.

    y + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    The Y coordinate of the upper-left corner of the framing rectangle of this ellipse.

    width + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    The overall width of this ellipse.

    height + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    The overall height of this ellipse.

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

    This Ellipse object

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Ellipse + + +
    +
    + + + + + +
    + + +
    + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    bottom

    + + +
    +
    + +
    +

    The sum of the y and height properties. Changing the bottom property of an Ellipse doesn't adjust the y property, but does change the height.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    bottom + + +number + + + +

    Gets or sets the bottom of the ellipse.

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

    empty

    + + +
    +
    + +
    +

    Determines whether or not this Ellipse object is empty. Will return a value of true if the Ellipse objects dimensions are less than or equal to 0; otherwise false. +If set to true it will reset all of the Ellipse objects properties to 0. An Ellipse object is empty if its width or height is less than or equal to 0.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    empty + + +boolean + + + +

    Gets or sets the empty state of the ellipse.

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

    height

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

    The overall height of this ellipse.

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

    left

    + + +
    +
    + +
    +

    The left coordinate of the Ellipse. The same as the X coordinate.

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

    The x coordinate of the rightmost point of the Ellipse. Changing the right property of an Ellipse object has no effect on the x property, but does adjust the width.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    right + + +number + + + +

    Gets or sets the value of the rightmost point of the ellipse.

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

    top

    + + +
    +
    + +
    +

    The top of the Ellipse. The same as its y property.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    top + + +number + + + +

    Gets or sets the top of the ellipse.

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

    width

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

    The overall width of this ellipse.

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

    x

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +number + + + +

    The X coordinate of the upper-left corner of the framing rectangle of this ellipse.

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

    y

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    y + + +number + + + +

    The Y coordinate of the upper-left corner of the framing rectangle of this ellipse.

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

    Methods

    + +
    + +
    +

    <static> contains(a, x, y) → {boolean}

    + + +
    +
    + + +
    +

    Return true if the given x/y coordinates are within the Ellipse object.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    a + + +Phaser.Ellipse + + + +

    The Ellipse to be checked.

    x + + +number + + + +

    The X value of the coordinate to test.

    y + + +number + + + +

    The Y value of the coordinate to test.

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

    True if the coordinates are within this ellipse, otherwise false.

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

    clone(out) → {Phaser.Ellipse}

    + + +
    +
    + + +
    +

    Returns a new Ellipse object with the same values for the x, y, width, and height properties as this Ellipse object.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    out + + +Phaser.Ellipse + + + +

    Optional Ellipse object. If given the values will be set into the object, otherwise a brand new Ellipse object will be created and returned.

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

    The cloned Ellipse object.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Ellipse + + +
    +
    + + + + + +
    + + + +
    +

    contains(x, y) → {boolean}

    + + +
    +
    + + +
    +

    Return true if the given x/y coordinates are within this Ellipse object.

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

    The X value of the coordinate to test.

    y + + +number + + + +

    The Y value of the coordinate to test.

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

    True if the coordinates are within this ellipse, otherwise false.

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

    copyFrom(source) → {Phaser.Ellipse}

    + + +
    +
    + + +
    +

    Copies the x, y, width and height properties from any given object to this Ellipse.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    source + + +any + + + +

    The object to copy from.

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

    This Ellipse object.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Ellipse + + +
    +
    + + + + + +
    + + + +
    +

    copyTo(dest) → {Object}

    + + +
    +
    + + +
    +

    Copies the x, y and diameter properties from this Circle to any given object.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    dest + + +any + + + +

    The object to copy to.

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

    This dest object.

    +
    + + + +
    +
    + Type +
    +
    + +Object + + +
    +
    + + + + + +
    + + + +
    +

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

    + + +
    +
    + + +
    +

    Sets the members of the Ellipse to the specified values.

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

    The X coordinate of the upper-left corner of the framing rectangle of this ellipse.

    y + + +number + + + +

    The Y coordinate of the upper-left corner of the framing rectangle of this ellipse.

    width + + +number + + + +

    The overall width of this ellipse.

    height + + +number + + + +

    The overall height of this ellipse.

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

    This Ellipse object.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Ellipse + + +
    +
    + + + + + +
    + + + +
    +

    toString() → {string}

    + + +
    +
    + + +
    +

    Returns a string representation of this object.

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

    A string representation of the instance.

    +
    + + + +
    +
    + Type +
    +
    + +string + + +
    +
    + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2014 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.3.0-dev + on Tue Feb 18 2014 03:01:20 GMT-0000 (GMT) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Phaser.Events.html b/docs/Phaser.Events.html index 070500c3..d51694be 100644 --- a/docs/Phaser.Events.html +++ b/docs/Phaser.Events.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -621,7 +629,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:45 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:20 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Filter.html b/docs/Phaser.Filter.html index b9c05442..964165c0 100644 --- a/docs/Phaser.Filter.html +++ b/docs/Phaser.Filter.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -733,7 +741,7 @@
    Source:
    @@ -835,7 +843,7 @@
    Source:
    @@ -1039,7 +1047,7 @@
    Source:
    @@ -1144,7 +1152,7 @@
    Source:
    @@ -1348,7 +1356,7 @@
    Source:
    @@ -1450,7 +1458,7 @@
    Source:
    @@ -1515,7 +1523,7 @@
    Source:
    @@ -1584,7 +1592,7 @@
    Source:
    @@ -1725,7 +1733,7 @@
    Source:
    @@ -1855,7 +1863,7 @@
    Source:
    @@ -1906,7 +1914,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:45 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:21 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Frame.html b/docs/Phaser.Frame.html index dee7f5d7..81cd6397 100644 --- a/docs/Phaser.Frame.html +++ b/docs/Phaser.Frame.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -3135,7 +3143,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:45 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:21 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.FrameData.html b/docs/Phaser.FrameData.html index 03eab0de..748a74c2 100644 --- a/docs/Phaser.FrameData.html +++ b/docs/Phaser.FrameData.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1929,7 +1937,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 Sat Feb 08 2014 07:19:45 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:21 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Game.html b/docs/Phaser.Game.html index 5aa5199b..d3b326ad 100644 --- a/docs/Phaser.Game.html +++ b/docs/Phaser.Game.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -941,14 +949,11 @@ providing quick access to common functions and handling the boot process. -
    Default Value:
    -
    • null
    -
    Source:
    @@ -1158,7 +1163,7 @@ providing quick access to common functions and handling the boot process.
    Source:
    @@ -1256,14 +1261,11 @@ providing quick access to common functions and handling the boot process. -
    Default Value:
    -
    • null
    -
    Source:
    @@ -1336,7 +1338,7 @@ providing quick access to common functions and handling the boot process. -

    A handy reference to renderer.view.

    +

    A handy reference to renderer.view, the canvas that the game is being rendered in to.

    @@ -1361,14 +1363,11 @@ providing quick access to common functions and handling the boot process. -
    Default Value:
    -
    • null
    -
    Source:
    @@ -1543,7 +1542,7 @@ providing quick access to common functions and handling the boot process. -

    A handy reference to renderer.context (only set for CANVAS games)

    +

    A handy reference to renderer.context (only set for CANVAS games, not WebGL)

    @@ -1568,14 +1567,11 @@ providing quick access to common functions and handling the boot process. -
    Default Value:
    -
    • null
    -
    Source:
    @@ -1673,14 +1669,11 @@ providing quick access to common functions and handling the boot process. -
    Default Value:
    -
    • null
    -
    Source:
    @@ -1778,14 +1771,11 @@ providing quick access to common functions and handling the boot process. -
    Default Value:
    -
    • null
    -
    Source:
    @@ -2097,7 +2087,7 @@ providing quick access to common functions and handling the boot process.
    Source:
    @@ -2412,7 +2402,7 @@ providing quick access to common functions and handling the boot process.
    Source:
    @@ -2510,14 +2500,11 @@ providing quick access to common functions and handling the boot process. -
    Default Value:
    -
    • null
    -
    Source:
    @@ -2615,14 +2602,11 @@ providing quick access to common functions and handling the boot process. -
    Default Value:
    -
    • null
    -
    Source:
    @@ -2822,14 +2806,11 @@ providing quick access to common functions and handling the boot process. -
    Default Value:
    -
    • null
    -
    Source:
    @@ -2936,7 +2917,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
    Source:
    @@ -3041,7 +3022,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
    Source:
    @@ -3104,7 +3085,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on -Phaser.Physics.PhysicsManager +Phaser.Physics.World @@ -3114,7 +3095,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on -

    Reference to the physics manager.

    +

    Reference to the physics world.

    @@ -3139,14 +3120,11 @@ When a game is paused the onPause event is dispatched. When it is resumed the on -
    Default Value:
    -
    • null
    -
    Source:
    @@ -3244,14 +3222,11 @@ When a game is paused the onPause event is dispatched. When it is resumed the on -
    Default Value:
    -
    • null
    -
    Source:
    @@ -3553,14 +3528,113 @@ When a game is paused the onPause event is dispatched. When it is resumed the on -
    Default Value:
    -
    • null
    + + +
    Source:
    +
    + + + + + + + + + + + + + + + +
    +

    scale

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    scale + + +Phaser.StageScaleMode + + + +

    The game scale manager.

    +
    + + + + + + + + + + + + + + + + +
    Source:
    @@ -3658,9 +3732,6 @@ When a game is paused the onPause event is dispatched. When it is resumed the on -
    Default Value:
    -
    • null
    -
    Source:
    @@ -3763,14 +3834,11 @@ When a game is paused the onPause event is dispatched. When it is resumed the on -
    Default Value:
    -
    • null
    -
    Source:
    @@ -3977,7 +4045,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
    Source:
    @@ -4082,7 +4150,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
    Source:
    @@ -4180,14 +4248,11 @@ When a game is paused the onPause event is dispatched. When it is resumed the on -
    Default Value:
    -
    • null
    -
    Source:
    @@ -4390,14 +4455,11 @@ When a game is paused the onPause event is dispatched. When it is resumed the on -
    Default Value:
    -
    • null
    -
    Source:
    @@ -4600,14 +4662,11 @@ When a game is paused the onPause event is dispatched. When it is resumed the on -
    Default Value:
    -
    • null
    -
    Source:
    @@ -4672,7 +4731,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
    Source:
    @@ -4741,7 +4800,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
    Source:
    @@ -4810,7 +4869,7 @@ When a game is paused the onPause event is dispatched. When it is resumed the on
    Source:
    @@ -4880,7 +4939,7 @@ Calling step will advance the game loop by one frame. This is extremely useful t
    Source:
    @@ -4949,7 +5008,7 @@ Calling step will advance the game loop by one frame. This is extremely useful t
    Source:
    @@ -5018,7 +5077,7 @@ Calling step will advance the game loop by one frame. This is extremely useful t
    Source:
    @@ -5087,7 +5146,7 @@ Calling step will advance the game loop by one frame. This is extremely useful t
    Source:
    @@ -5156,7 +5215,7 @@ Calling step will advance the game loop by one frame. This is extremely useful t
    Source:
    @@ -5225,7 +5284,7 @@ Calling step will advance the game loop by one frame. This is extremely useful t
    Source:
    @@ -5295,7 +5354,7 @@ This is extremely useful to hard to track down errors! Use the internal stepCoun
    Source:
    @@ -5413,7 +5472,7 @@ This is extremely useful to hard to track down errors! Use the internal stepCoun
    Source:
    @@ -5464,7 +5523,7 @@ This is extremely useful to hard to track down errors! Use the internal stepCoun Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:45 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:21 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.GameObjectFactory.html b/docs/Phaser.GameObjectFactory.html index 7870a0e4..44667951 100644 --- a/docs/Phaser.GameObjectFactory.html +++ b/docs/Phaser.GameObjectFactory.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1033,7 +1041,7 @@
    Source:
    @@ -1311,7 +1319,7 @@
    Source:
    @@ -1362,7 +1370,7 @@
    -

    bitmapText(x, y, text, style, group) → {Phaser.BitmapText}

    +

    bitmapFont(font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset) → {Phaser.BitmapFont}

    @@ -1370,9 +1378,462 @@
    -
      -
    • Create a new BitmapText object.
    • -
    +

    Create a new BitmapFont object to be used as a texture for an Image or Sprite and optionally add it to the Cache. +The texture can be asssigned or one or multiple images/sprites, but note that the text the BitmapFont uses will be shared across them all, +i.e. if you need each Image to have different text in it, then you need to create multiple BitmapFont objects.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    font + + +string + + + + + + + + + + + +

    The key of the image in the Game.Cache that the BitmapFont will use.

    characterWidth + + +number + + + + + + + + + + + +

    The width of each character in the font set.

    characterHeight + + +number + + + + + + + + + + + +

    The height of each character in the font set.

    chars + + +string + + + + + + + + + + + +

    The characters used in the font set, in display order. You can use the TEXT_SET consts for common font set arrangements.

    charsPerRow + + +number + + + + + + + + + + + +

    The number of characters per row in the font set.

    xSpacing + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    If the characters in the font set have horizontal spacing between them set the required amount here.

    ySpacing + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    If the characters in the font set have vertical spacing between them set the required amount here.

    xOffset + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    If the font set doesn't start at the top left of the given image, specify the X coordinate offset here.

    yOffset + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    If the font set doesn't start at the top left of the given image, specify the Y coordinate offset here.

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

    The newly created BitmapFont texture which can be applied to an Image or Sprite.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.BitmapFont + + +
    +
    + + + + + +
    + + + +
    +

    bitmapText(x, y, font, text, size, group) → {Phaser.BitmapText}

    + + +
    +
    + + +
    +

    Create a new BitmapText object.

    @@ -1470,7 +1931,7 @@ - text + font @@ -1494,20 +1955,20 @@ -

    The actual text that will be written.

    +

    The key of the BitmapText font as stored in Game.Cache.

    - style + text -object +string @@ -1516,6 +1977,8 @@ + <optional>
    + @@ -1525,7 +1988,40 @@ -

    The style object containing style attributes like font, font size , etc.

    +

    The actual text that will be rendered. Can be set later via BitmapText.text.

    + + + + + + + size + + + + + +number + + + + + + + + + <optional>
    + + + + + + + + + + +

    The size the font will be rendered in, in pixels.

    @@ -1590,7 +2086,7 @@
    Source:
    @@ -2052,7 +2548,7 @@
    Source:
    @@ -2293,7 +2789,7 @@ at set intervals, and fixes their positions and velocities accorindgly.

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

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

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

    -

    group(parent, name) → {Phaser.Group}

    +

    group(parent, name, addToStage) → {Phaser.Group}

    @@ -2981,6 +3477,45 @@ at set intervals, and fixes their positions and velocities accorindgly.

    + + + + addToStage + + + + + +boolean + + + + + + + + + <optional>
    + + + + + + + + + + + + false + + + + +

    If set to true this Group will be added directly to the Game.Stage instead of Game.World.

    + + + @@ -3576,7 +4111,7 @@ It can still rotate, scale, crop and receive input events. This makes it perfect
    Source:
    @@ -3850,7 +4385,7 @@ It can still rotate, scale, crop and receive input events. This makes it perfect
    Source:
    @@ -4184,6 +4719,241 @@ It can still rotate, scale, crop and receive input events. This makes it perfect + + + + +
    +

    spriteBatch(parent, name, addToStage) → {Phaser.Group}

    + + +
    +
    + + +
    +

    A Group is a container for display objects that allows for fast pooling, recycling and collision checks.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    parent + + +any + + + + + + + + + + + +

    The parent Group or DisplayObjectContainer that will hold this group, if any.

    name + + +string + + + + + + <optional>
    + + + + + +
    + + 'group' + +

    A name for this Group. Not used internally but useful for debugging.

    addToStage + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    If set to true this Group will be added directly to the Game.Stage instead of Game.World.

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

    The newly created group.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Group + + +
    +
    + + + + +
    @@ -4415,7 +5185,7 @@ It can still rotate, scale, crop and receive input events. This makes it perfect
    Source:
    @@ -4582,7 +5352,7 @@ It can still rotate, scale, crop and receive input events. This makes it perfect
    Source:
    @@ -4633,7 +5403,7 @@ It can still rotate, scale, crop and receive input events. This makes it perfect
    -

    tileSprite(x, y, width, height, key, group) → {Phaser.TileSprite}

    +

    tileSprite(x, y, width, height, key, frame, group) → {Phaser.TileSprite}

    @@ -4701,7 +5471,7 @@ It can still rotate, scale, crop and receive input events. This makes it perfect -

    X position of the new tileSprite.

    +

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

    @@ -4732,7 +5502,7 @@ It can still rotate, scale, crop and receive input events. This makes it perfect -

    Y position of the new tileSprite.

    +

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

    @@ -4763,7 +5533,7 @@ It can still rotate, scale, crop and receive input events. This makes it perfect -

    the width of the tilesprite.

    +

    The width of the TileSprite.

    @@ -4794,7 +5564,7 @@ It can still rotate, scale, crop and receive input events. This makes it perfect -

    the height of the tilesprite.

    +

    The height of the TileSprite.

    @@ -4813,6 +5583,9 @@ It can still rotate, scale, crop and receive input events. This makes it perfect Phaser.RenderTexture | +Phaser.BitmapData +| + PIXI.Texture @@ -4831,7 +5604,41 @@ It can still rotate, scale, crop and receive input events. This makes it perfect -

    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.

    +

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

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

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

    @@ -4896,7 +5703,7 @@ It can still rotate, scale, crop and receive input events. This makes it perfect
    Source:
    @@ -5111,7 +5918,7 @@ It can still rotate, scale, crop and receive input events. This makes it perfect Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:45 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:21 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Gamepad.html b/docs/Phaser.Gamepad.html index 71212853..270f4465 100644 --- a/docs/Phaser.Gamepad.html +++ b/docs/Phaser.Gamepad.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -3396,7 +3404,7 @@ This MUST be called manually before Phaser will start polling the Gamepad API. Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:45 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:21 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.GamepadButton.html b/docs/Phaser.GamepadButton.html index 57a0aa0d..b07768f2 100644 --- a/docs/Phaser.GamepadButton.html +++ b/docs/Phaser.GamepadButton.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -2574,7 +2582,7 @@ If the button is up it holds the duration of the previous down session.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:46 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:21 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Graphics.html b/docs/Phaser.Graphics.html index 70d2d789..4ef36035 100644 --- a/docs/Phaser.Graphics.html +++ b/docs/Phaser.Graphics.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -645,6 +653,633 @@
    +
    +

    angle

    + + +
    +
    + +
    +

    Indicates the rotation of the Graphics, 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 angle of rotation in degrees.

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

    cameraOffset

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

    If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.

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

    exists

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

    If exists = false then the Text isn't updated by the core game loop.

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

    fixedToCamera

    + + +
    +
    + +
    +

    An Graphics that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Graphics.cameraOffset. +Note that the cameraOffset values are in addition to any parent in the display list. +So if this Graphics was in a Group that has x: 200, then this will be added to the cameraOffset.x

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

    Set to true to fix this Graphics to the Camera at its current world coordinates.

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

    game

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

    A reference to the currently running Game.

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

    name

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

    The user defined name given to this object.

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

    type

    @@ -701,7 +1336,7 @@ -

    The Phaser Object Type.

    +

    The const type of this object.

    @@ -730,7 +1365,109 @@
    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:
    +
    @@ -749,6 +1486,217 @@ +

    Methods

    + +
    + +
    +

    postUpdate()

    + + +
    +
    + + +
    +

    Automatically called by World.postUpdate.

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

    preUpdate()

    + + +
    +
    + + +
    +

    Automatically called by World.preUpdate.

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

    update()

    + + +
    +
    + + +
    +

    Override and use this function in your own custom objects to handle any update requirements you may have.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    + @@ -773,7 +1721,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:46 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:22 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Group.html b/docs/Phaser.Group.html index c8a44cf1..4e6c4f0a 100644 --- a/docs/Phaser.Group.html +++ b/docs/Phaser.Group.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -455,7 +463,7 @@ Group -

    A Group is a container for display objects that allows for fast pooling, recycling and collision checks.

    +

    A Group is a container for display objects that allows for fast pooling and object recycling. Groups can be nested within other Groups and have their own local transforms.

    @@ -466,7 +474,7 @@
    -

    new Group(game, parent, name, useStage)

    +

    new Group(game, parent, name, addToStage)

    @@ -553,7 +561,10 @@ -* +Phaser.Group +| + +Phaser.Sprite @@ -621,7 +632,7 @@ - useStage + addToStage @@ -653,7 +664,7 @@ -

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

    +

    If set to true this Group will be added directly to the Game.Stage instead of Game.World.

    @@ -771,7 +782,7 @@
    Source:
    @@ -831,7 +842,7 @@
    Source:
    @@ -891,7 +902,7 @@
    Source:
    @@ -951,7 +962,7 @@
    Source:
    @@ -1011,7 +1022,7 @@
    Source:
    @@ -1218,7 +1229,7 @@
    Source:
    @@ -1325,7 +1336,109 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    cameraOffset

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

    If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1432,7 +1545,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -1546,6 +1659,114 @@ The cursor is set to the first child added to the Group and doesn't change unles +
    + + + +
    + + + +
    +

    fixedToCamera

    + + +
    +
    + +
    +

    A Group that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Group.cameraOffset. +Note that the cameraOffset values are in addition to any parent in the display list. +So if this Group was in a Group that has x: 200, then this will be added to the cameraOffset.x

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

    Set to true to fix this Group to the Camera at its current world coordinates.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + +
    @@ -1741,7 +1962,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -1950,7 +2171,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2052,7 +2273,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2154,7 +2375,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2358,7 +2579,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2465,7 +2686,7 @@ This will have no impact on the x/y coordinates of its children, but it will upd
    Source:
    @@ -2572,7 +2793,7 @@ This will have no impact on the x/y coordinates of its children, but it will upd
    Source:
    @@ -2688,7 +2909,7 @@ that then see the addAt method.

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

    Source:
    @@ -3050,7 +3271,7 @@ The child is added to the Group at the location specified by the index value, th
    Source:
    @@ -3191,7 +3412,7 @@ The child is added to the Group at the location specified by the index value, th
    Source:
    @@ -3425,7 +3646,7 @@ After the method parameter and context you can add as many extra parameters as y
    Source:
    @@ -3618,7 +3839,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -3782,7 +4003,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -3851,7 +4072,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -3943,7 +4164,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -4250,7 +4471,7 @@ Useful if you don't need to create the Sprite instances before-hand.

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

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

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

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

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

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

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

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

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

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

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

    <protected> postUpdate()

    + + +
    +
    + + +
    +

    The core postUpdate - as called by World.

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

    <protected> preUpdate()

    + + +
    +
    + + +
    +

    The core preUpdate - as called by World.

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

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

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

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

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

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

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

    <protected> update()

    + + +
    +
    + + +
    +

    The core update - as called by World.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -8753,7 +9181,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 Sat Feb 08 2014 07:19:46 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:22 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Image.html b/docs/Phaser.Image.html index 37ef0e85..e9edcd04 100644 --- a/docs/Phaser.Image.html +++ b/docs/Phaser.Image.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -708,9 +716,9 @@ It can still rotate, scale, crop and receive input events. This makes it perfect
    -

    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. +

    Indicates the rotation of the Image, 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.

    +If you wish to work in radians instead of degrees use the property Image.rotation instead. Working in radians is also a little faster as it doesn't have to convert the angle.

    @@ -791,7 +799,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    @@ -816,7 +824,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

    Should this Sprite be automatically culled if out of range of the camera? +

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

    @@ -870,7 +878,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun -

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

    +

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

    @@ -902,7 +910,109 @@ Be advised this is quite an expensive operation, as it has to calculate the boun
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    cameraOffset

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

    If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1008,7 +1118,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun
    Source:
    @@ -1114,7 +1224,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun
    Source:
    @@ -1220,7 +1330,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun
    Source:
    @@ -1293,7 +1403,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun -

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

    +

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

    @@ -1395,7 +1505,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun -

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

    +

    If exists = false then the Image isn't updated by the core game loop.

    @@ -1452,8 +1562,9 @@ Be advised this is quite an expensive operation, as it has to calculate the boun
    -

    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.

    +

    An Image that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Image.cameraOffset. +Note that the cameraOffset values are in addition to any parent in the display list. +So if this Image was in a Group that has x: 200, then this will be added to the cameraOffset.x

    @@ -1505,7 +1616,7 @@ Note that if this Image is a child of a display object that has changed its posi -

    Fixes this Sprite to the Camera.

    +

    Set to true to fix this Image to the Camera at its current world coordinates.

    @@ -1530,14 +1641,11 @@ Note that if this Image is a child of a display object that has changed its posi -
    Default Value:
    -
    • false
    -
    Source:
    @@ -1639,7 +1747,7 @@ Note that if this Image is a child of a display object that has changed its posi
    Source:
    @@ -1741,7 +1849,7 @@ Note that if this Image is a child of a display object that has changed its posi
    Source:
    @@ -1949,7 +2057,7 @@ Note that if this Image is a child of a display object that has changed its posi
    Source:
    @@ -2054,7 +2162,7 @@ Note that if this Image is a child of a display object that has changed its posi
    Source:
    @@ -2161,7 +2269,7 @@ activated for this object and it will then start to process click/touch events a
    Source:
    @@ -2267,7 +2375,7 @@ activated for this object and it will then start to process click/touch events a
    Source:
    @@ -2349,7 +2457,7 @@ activated for this object and it will then start to process click/touch events a -

    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 is the image or 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.

    @@ -2451,7 +2559,7 @@ activated for this object and it will then start to process click/touch events a -

    The user defined name given to this Sprite.

    +

    The user defined name given to this Image.

    @@ -2582,7 +2690,7 @@ activated for this object and it will then start to process click/touch events a
    Source:
    @@ -2757,7 +2865,7 @@ activated for this object and it will then start to process click/touch events a -

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

    +

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

    @@ -2786,7 +2894,7 @@ activated for this object and it will then start to process click/touch events a
    Source:
    @@ -2818,7 +2926,7 @@ activated for this object and it will then start to process click/touch events a
    -

    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 +

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

    @@ -2852,7 +2960,7 @@ bought to the top of that Group, not the entire display list.

    Source:
    @@ -2994,7 +3102,7 @@ Cropping takes place from the top-left of the Image and can be modified in real-
    Source:
    @@ -3030,7 +3138,7 @@ Cropping takes place from the top-left of the Image and can be modified in real-
    -

    Destroys the Sprite. This removes it from its parent group, destroys the input, event and animation handlers if present +

    Destroys the Image. 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.

    @@ -3064,7 +3172,7 @@ and nulls its reference to game, freeing it up for garbage collection.

    Source:
    @@ -3100,10 +3208,10 @@ and nulls its reference to game, freeing it up for garbage collection.

    -

    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.

    +

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

    @@ -3136,7 +3244,7 @@ If you don't need this Sprite any more you should call Sprite.destroy instead.Source:
    @@ -3195,7 +3303,7 @@ If you don't need this Sprite any more you should call Sprite.destroy instead. -

    Changes the Texture the Sprite is using entirely. The old texture is removed and the new one is referenced or fetched from the Cache. +

    Changes the Texture the Image 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.

    @@ -3255,7 +3363,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion -

    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 is the image or 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.

    @@ -3281,7 +3389,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion -

    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.

    +

    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.

    @@ -3313,7 +3421,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
    Source:
    @@ -3382,7 +3490,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
    Source:
    @@ -3451,7 +3559,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
    Source:
    @@ -3487,7 +3595,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
    -

    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.

    +

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

    @@ -3537,7 +3645,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion -

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

    +

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

    @@ -3560,7 +3668,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion -

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

    +

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

    @@ -3592,7 +3700,7 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
    Source:
    @@ -3651,9 +3759,9 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion
    -

    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.

    +

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

    @@ -3686,7 +3794,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    @@ -3732,6 +3840,75 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived +
    + + + +
    +

    update()

    + + +
    +
    + + +
    +

    Override and use this function in your own custom objects to handle any update requirements you may have.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + +
    @@ -3760,7 +3937,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:46 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:22 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Input.html b/docs/Phaser.Input.html index 92a1a934..4eb65c81 100644 --- a/docs/Phaser.Input.html +++ b/docs/Phaser.Input.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -7685,7 +7693,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 Sat Feb 08 2014 07:19:46 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:22 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.InputHandler.html b/docs/Phaser.InputHandler.html index 279238bb..6d27bedc 100644 --- a/docs/Phaser.InputHandler.html +++ b/docs/Phaser.InputHandler.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -897,7 +905,7 @@
    Source:
    @@ -1002,7 +1010,7 @@
    Source:
    @@ -1217,7 +1225,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
    Source:
    @@ -1322,7 +1330,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
    Source:
    @@ -1643,111 +1651,6 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c - - - - - - - - -
    -

    pixelPerfect

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    pixelPerfect - - -number - - - -

    Should we use pixel perfect hit detection? Warning: expensive. Only enable if you really need it!

    -
    - - - - - - - - - - - - - - - - - - -
    Default Value:
    -
    • false
    - - - -
    Source:
    -
    - - - - - - -
    @@ -1844,7 +1747,229 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
    Source:
    + + + + + + + + + + + + + + + +
    +

    pixelPerfectClick

    + + +
    +
    + +
    +

    Set to true to use pixel perfect hit detection when checking if the pointer is over this Sprite when it's clicked or touched. +The x/y coordinates of the pointer are tested against the image in combination with the InputHandler.pixelPerfectAlpha value. +Warning: This is expensive so only enable if you really need it.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pixelPerfectClick + + +number + + + +

    Use a pixel perfect check when testing for clicks or touches on the Sprite.

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

    pixelPerfectOver

    + + +
    +
    + +
    +

    Set to true to use pixel perfect hit detection when checking if the pointer is over this Sprite. +The x/y coordinates of the pointer are tested against the image in combination with the InputHandler.pixelPerfectAlpha value. +Warning: This is expensive, especially on mobile (where it's not even needed!) so only enable if required. Also see the less-expensive InputHandler.pixelPerfectClick.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    pixelPerfectOver + + +number + + + +

    Use a pixel perfect check when testing for pointer over.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • false
    + + + +
    Source:
    +
    @@ -2956,7 +3081,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
    Source:
    @@ -3025,7 +3150,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
    Source:
    @@ -3053,7 +3178,7 @@ For example if you had a stack of 6 sprites with the same priority IDs and one c
    -

    checkPixel(x, y) → {boolean}

    +

    checkPixel(x, y, pointer) → {boolean}

    @@ -3071,6 +3196,221 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    x + + +number + + + + + + + + + +

    The x coordinate to check.

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

    The y coordinate to check.

    pointer + + +Phaser.Pointer + + + + + + <optional>
    + + + + + +

    The pointer to get the x/y coordinate from if not passed as the first two parameters.

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

    true if there is the alpha of the pixel is >= InputHandler.pixelPerfectAlpha

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

    checkPointerDown(pointer) → {boolean}

    + + +
    +
    + + +
    +

    Checks if the given pointer is over this Sprite and can click it.

    +
    + + + + + + +
    Parameters:
    @@ -3096,13 +3436,13 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA - x + pointer -number +Phaser.Pointer @@ -3112,30 +3452,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA -

    The x coordinate to check.

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

    The y coordinate to check.

    + @@ -3167,7 +3484,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
    Source:
    @@ -3191,10 +3508,6 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
    Returns:
    -
    -

    true if there is the alpha of the pixel is >= InputHandler.pixelPerfectAlpha

    -
    -
    @@ -3308,7 +3621,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
    Source:
    @@ -3396,7 +3709,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
    Source:
    @@ -3465,7 +3778,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
    Source:
    @@ -3534,7 +3847,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
    Source:
    @@ -3652,7 +3965,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
    Source:
    @@ -4008,7 +4321,7 @@ It compares the alpha value of the pixel and if >= InputHandler.pixelPerfectA
    Source:
    @@ -4334,7 +4647,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -4475,7 +4788,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -4635,7 +4948,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -4690,7 +5003,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    -

    Returns true if the pointer has entered the Sprite within the specified delay time (defaults to 500ms, half a second)

    +

    Returns true if the pointer has touched or clicked on the Sprite within the specified delay time (defaults to 500ms, half a second)

    @@ -4795,7 +5108,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -4850,7 +5163,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    -

    Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second)

    +

    Returns true if the pointer was touching this Sprite, but has been released within the specified delay time (defaults to 500ms, half a second)

    @@ -4955,7 +5268,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -5092,7 +5405,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -5233,7 +5546,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -5382,7 +5695,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -5535,7 +5848,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -5676,7 +5989,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -5813,7 +6126,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -5950,7 +6263,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -6087,7 +6400,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -6224,7 +6537,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -6361,7 +6674,7 @@ For example 16x16 as the snapX and snapY would make the sprite snap to every 16
    Source:
    @@ -6499,7 +6812,7 @@ This value is only set when the pointer is over this Sprite.

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

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

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

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

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

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

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

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

    -

    update(pointer)

    +

    <protected> update(pointer)

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

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

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

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:46 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:22 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Key.html b/docs/Phaser.Key.html index e7c81147..1f3fd00b 100644 --- a/docs/Phaser.Key.html +++ b/docs/Phaser.Key.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -2564,7 +2572,7 @@ If the key is up it holds the duration of the previous down session.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:47 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:22 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Keyboard.html b/docs/Phaser.Keyboard.html index 38a54649..fa32b5b1 100644 --- a/docs/Phaser.Keyboard.html +++ b/docs/Phaser.Keyboard.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -2991,7 +2999,7 @@ This is called automatically by Phaser.Input and should not normally be invoked Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:47 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:22 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Line.html b/docs/Phaser.Line.html index 78ac8afe..867f6cce 100644 --- a/docs/Phaser.Line.html +++ b/docs/Phaser.Line.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -3087,7 +3095,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 Sat Feb 08 2014 07:19:47 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:23 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.LinkedList.html b/docs/Phaser.LinkedList.html index e55a3b05..c1eb6683 100644 --- a/docs/Phaser.LinkedList.html +++ b/docs/Phaser.LinkedList.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1483,7 +1491,7 @@ The function must exist on the member.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:47 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:23 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Loader.html b/docs/Phaser.Loader.html index 958fb0d5..212c0369 100644 --- a/docs/Phaser.Loader.html +++ b/docs/Phaser.Loader.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -602,6 +610,66 @@ It uses a combination of Image() loading and xhr and provides progress and compl
    +
    +

    <static, constant> PHYSICS_LIME_CORONA :number

    + + +
    +
    + + + +
    Type:
    +
      +
    • + +number + + +
    • +
    + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + +

    <static, constant> TEXTURE_ATLAS_JSON_ARRAY :number

    @@ -645,7 +713,7 @@ It uses a combination of Image() loading and xhr and provides progress and compl
    Source:
    @@ -705,7 +773,7 @@ It uses a combination of Image() loading and xhr and provides progress and compl
    Source:
    @@ -765,7 +833,7 @@ It uses a combination of Image() loading and xhr and provides progress and compl
    Source:
    @@ -873,7 +941,7 @@ MUST have / on the end of it!

    Source:
    @@ -936,6 +1004,9 @@ MUST have / on the end of it!

    +boolean +| + string @@ -946,7 +1017,7 @@ MUST have / on the end of it!

    -

    The crossOrigin value applied to loaded images

    +

    The crossOrigin value applied to loaded images.

    @@ -971,11 +1042,14 @@ MUST have / on the end of it!

    +
    Default Value:
    +
    • false
    +
    Source:
    @@ -1389,7 +1463,7 @@ MUST have / on the end of it!

    Source:
    @@ -1491,7 +1565,7 @@ MUST have / on the end of it!

    Source:
    @@ -1593,7 +1667,7 @@ MUST have / on the end of it!

    Source:
    @@ -1695,7 +1769,7 @@ MUST have / on the end of it!

    Source:
    @@ -1721,7 +1795,7 @@ MUST have / on the end of it!

    You can optionally link a sprite to the preloader. -If you do so the Sprite's width or height will be cropped based on the percentage loaded.

    +If you do so the Sprites width or height will be cropped based on the percentage loaded.

    @@ -1764,6 +1838,9 @@ If you do so the Sprite's width or height will be cropped based on the percentag Phaser.Sprite +| + +Phaser.Image @@ -2198,7 +2275,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
    Source:
    @@ -2456,7 +2533,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
    Source:
    @@ -2704,7 +2781,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
    Source:
    @@ -2952,7 +3029,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
    Source:
    @@ -3200,7 +3277,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
    Source:
    @@ -3390,7 +3467,7 @@ If you do so the Sprite's width or height will be cropped based on the percentag
    Source:
    @@ -3640,7 +3717,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -3691,7 +3768,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    -

    bitmapFont(key, textureURL, xmlURL, xmlData) → {Phaser.Loader}

    +

    bitmapFont(key, textureURL, xmlURL, xmlData, xSpacing, ySpacing) → {Phaser.Loader}

    @@ -3725,6 +3802,8 @@ WARNING: If you specify a callback, the file data will be set to whatever your c + Default + Description @@ -3758,6 +3837,10 @@ WARNING: If you specify a callback, the file data will be set to whatever your c + + + +

    Unique asset key of the bitmap font.

    @@ -3789,6 +3872,10 @@ WARNING: If you specify a callback, the file data will be set to whatever your c + + + +

    The url of the font image file.

    @@ -3822,6 +3909,10 @@ WARNING: If you specify a callback, the file data will be set to whatever your c + + + +

    The url of the font data file (xml/fnt)

    @@ -3855,11 +3946,93 @@ WARNING: If you specify a callback, the file data will be set to whatever your c + + + +

    An optional XML data object.

    + + + + xSpacing + + + + + +number + + + + + + + + + <optional>
    + + + + + + + + + + + + 0 + + + + +

    If you'd like to add additional horizontal spacing between the characters then set the pixel value here.

    + + + + + + + ySpacing + + + + + +number + + + + + + + + + <optional>
    + + + + + + + + + + + + 0 + + + + +

    If you'd like to add additional vertical spacing between the lines then set the pixel value here.

    + + + @@ -3888,7 +4061,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -4052,7 +4225,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -4193,7 +4366,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -4311,7 +4484,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -4429,7 +4602,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -4547,7 +4720,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -4688,7 +4861,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -4919,7 +5092,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -5060,7 +5233,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -5083,6 +5256,277 @@ WARNING: If you specify a callback, the file data will be set to whatever your c + + + + +
    +

    physics(key, dataURL, jsonData, format) → {Phaser.Loader}

    + + +
    +
    + + +
    +

    Add a new physics data object loading request. +The data must be in Lime + Corona JSON format. Physics Editor by code'n'web exports in this format natively.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    key + + +string + + + + + + + + + + + +

    Unique asset key of the physics json data.

    dataURL + + +string + + + + + + <optional>
    + + + + + +
    + +

    The url of the map data file (csv/json)

    jsonData + + +object + + + + + + <optional>
    + + + + + +
    + +

    An optional JSON data object. If given then the dataURL is ignored and this JSON object is used for physics data instead.

    format + + +string + + + + + + <optional>
    + + + + + +
    + + Phaser.Physics.LIME_CORONA_JSON + +

    The format of the physics data.

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

    This Loader instance.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Loader + + +
    +
    + + + + +
    @@ -5129,7 +5573,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -5270,7 +5714,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -5457,7 +5901,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -5526,7 +5970,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -5667,7 +6111,7 @@ WARNING: If you specify a callback, the file data will be set to whatever your c
    Source:
    @@ -5865,7 +6309,7 @@ This allows you to easily make loading bars for games.

    Source:
    @@ -6221,7 +6665,7 @@ This allows you to easily make loading bars for games.

    Source:
    @@ -6313,7 +6757,7 @@ This allows you to easily make loading bars for games.

    Source:
    @@ -6521,7 +6965,7 @@ This allows you to easily make loading bars for games.

    Source:
    @@ -6791,7 +7235,7 @@ This allows you to easily make loading bars for games.

    Source:
    @@ -6883,7 +7327,7 @@ This allows you to easily make loading bars for games.

    Source:
    @@ -6975,7 +7419,7 @@ This allows you to easily make loading bars for games.

    Source:
    @@ -7116,7 +7560,7 @@ This allows you to easily make loading bars for games.

    Source:
    @@ -7167,7 +7611,7 @@ This allows you to easily make loading bars for games.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:47 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:23 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.LoaderParser.html b/docs/Phaser.LoaderParser.html index 0a8b82cc..d4d43137 100644 --- a/docs/Phaser.LoaderParser.html +++ b/docs/Phaser.LoaderParser.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -551,7 +559,7 @@
    -

    <static> bitmapFont(xml) → {FrameData}

    +

    <static> bitmapFont(game, xml, cacheKey)

    @@ -559,7 +567,7 @@
    -

    Parse frame data from an XML file.

    +

    Parse a Bitmap Font from an XML file.

    @@ -591,6 +599,29 @@ + + + game + + + + + +Phaser.Game + + + + + + + + + +

    A reference to the current game.

    + + + + xml @@ -613,6 +644,29 @@ + + + + cacheKey + + + + + +string + + + + + + + + + +

    The key of the texture this font uses in the cache.

    + + + @@ -662,29 +716,6 @@ -
    Returns:
    - - -
    -

    Generated FrameData object.

    -
    - - - -
    -
    - Type -
    -
    - -FrameData - - -
    -
    - - - @@ -715,7 +746,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:47 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:23 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.MSPointer.html b/docs/Phaser.MSPointer.html index 4ac95b71..cd4370dc 100644 --- a/docs/Phaser.MSPointer.html +++ b/docs/Phaser.MSPointer.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1433,7 +1441,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 Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:23 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Math.html b/docs/Phaser.Math.html index 0ca5ab5e..0c4d1274 100644 --- a/docs/Phaser.Math.html +++ b/docs/Phaser.Math.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -731,6 +739,166 @@ +
    Returns:
    + + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + + + + + +
    +

    angleBetweenPoints(point1, point2) → {number}

    + + +
    +
    + + +
    +

    Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y).

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    point1 + + +Phaser.Point + + + +
    point2 + + +Phaser.Point + + + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + +
    Returns:
    @@ -893,7 +1061,7 @@
    Source:
    @@ -1145,7 +1313,7 @@
    Source:
    @@ -1305,7 +1473,7 @@
    Source:
    @@ -1534,7 +1702,7 @@
    Source:
    @@ -1694,7 +1862,7 @@
    Source:
    @@ -1831,7 +1999,7 @@
    Source:
    @@ -2155,7 +2323,7 @@ of getting a bonus, call chanceRoll(30) - true means the chance passed, false me
    Source:
    @@ -2343,7 +2511,7 @@ Clamp value to range <a, b>

    Source:
    @@ -2503,7 +2671,7 @@ Clamp value to range <a, b>

    Source:
    @@ -2591,7 +2759,7 @@ Clamp value to range <a, b>

    Source:
    @@ -2747,7 +2915,7 @@ Clamp value to range <a, b>

    Source:
    @@ -2953,7 +3121,7 @@ Clamp value to range <a, b>

    Source:
    @@ -3254,7 +3422,7 @@ Clamp value to range <a, b>

    Source:
    @@ -3464,7 +3632,7 @@ Clamp value to range <a, b>

    Source:
    @@ -3605,7 +3773,7 @@ Clamp value to range <a, b>

    Source:
    @@ -4853,7 +5021,7 @@ Will return null if random selection is missing, or array has no entries.

    Source:
    @@ -5086,7 +5254,7 @@ Will return null if random selection is missing, or array has no entries.

    Source:
    @@ -5406,7 +5574,7 @@ Will return null if random selection is missing, or array has no entries.

    Source:
    @@ -5547,7 +5715,7 @@ Will return null if random selection is missing, or array has no entries.

    Source:
    @@ -5734,7 +5902,7 @@ Will return null if random selection is missing, or array has no entries.

    Source:
    @@ -5894,7 +6062,7 @@ Will return null if random selection is missing, or array has no entries.

    Source:
    @@ -6146,7 +6314,7 @@ Will return null if random selection is missing, or array has no entries.

    Source:
    @@ -6235,7 +6403,7 @@ See http://jsperf.com/m
    Source:
    @@ -6327,7 +6495,7 @@ See http://jsperf.com/m
    Source:
    @@ -6514,7 +6682,7 @@ See http://jsperf.com/m
    Source:
    @@ -6603,7 +6771,7 @@ It will find the largest matching property value from the given objects.

    Source:
    @@ -6696,7 +6864,7 @@ See http://jsperf.com/m
    Source:
    @@ -6789,7 +6957,7 @@ It will find the lowest matching property value from the given objects.

    Source:
    @@ -6976,7 +7144,7 @@ It will find the lowest matching property value from the given objects.

    Source:
    @@ -7163,7 +7331,7 @@ It will find the lowest matching property value from the given objects.

    Source:
    @@ -7300,7 +7468,7 @@ It will find the lowest matching property value from the given objects.

    Source:
    @@ -7441,7 +7609,7 @@ It will find the lowest matching property value from the given objects.

    Source:
    @@ -7582,7 +7750,7 @@ It will find the lowest matching property value from the given objects.

    Source:
    @@ -7746,7 +7914,7 @@ It will find the lowest matching property value from the given objects.

    Source:
    @@ -7792,6 +7960,147 @@ It will find the lowest matching property value from the given objects.

    + + + + +
    +

    p2px(v) → {number}

    + + +
    +
    + + +
    +

    Convert p2 physics value to pixel scale.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    v + + +number + + + +

    The value to convert.

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

    The scaled value.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + +
    @@ -7861,6 +8170,147 @@ It will find the lowest matching property value from the given objects.

    + + + + +
    +

    px2p(v) → {number}

    + + +
    +
    + + +
    +

    Convert pixel value to p2 physics scale.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    v + + +number + + + +

    The value to convert.

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

    The scaled value.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + +
    @@ -7907,7 +8357,7 @@ It will find the lowest matching property value from the given objects.

    Source:
    @@ -7995,7 +8445,7 @@ It will find the lowest matching property value from the given objects.

    Source:
    @@ -8136,7 +8586,7 @@ It will find the lowest matching property value from the given objects.

    Source:
    @@ -8621,7 +9071,7 @@ The original stack is modified in the process. This effectively moves the positi
    Source:
    @@ -8762,7 +9212,7 @@ The original stack is modified in the process. This effectively moves the positi
    Source:
    @@ -8904,7 +9354,7 @@ The original stack is modified in the process. This effectively moves the positi
    Source:
    @@ -9114,7 +9564,7 @@ you should get the results via getSinTable() and getCosTable(). This generator i
    Source:
    @@ -9301,7 +9751,7 @@ you should get the results via getSinTable() and getCosTable(). This generator i
    Source:
    @@ -9484,7 +9934,7 @@ you should get the results via getSinTable() and getCosTable(). This generator i
    Source:
    @@ -10619,7 +11069,7 @@ you should get the results via getSinTable() and getCosTable(). This generator i
    Source:
    @@ -10807,7 +11257,7 @@ max should be larger than min, or the function will return 0.

    Source:
    @@ -10949,7 +11399,7 @@ Should be called whenever the angle is updated on the Sprite to stop it from goi
    Source:
    @@ -11137,7 +11587,7 @@ Should be called whenever the angle is updated on the Sprite to stop it from goi
    Source:
    @@ -11211,7 +11661,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 Sat Feb 08 2014 07:19:47 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:23 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Mouse.html b/docs/Phaser.Mouse.html index a37f803a..e40fd9f9 100644 --- a/docs/Phaser.Mouse.html +++ b/docs/Phaser.Mouse.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -2750,7 +2758,7 @@ If the browser successfully enters a locked state the event Phaser.Mouse.pointer Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:23 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Net.html b/docs/Phaser.Net.html index b0d74dbb..8449b77a 100644 --- a/docs/Phaser.Net.html +++ b/docs/Phaser.Net.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1377,7 +1385,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 Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:23 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Particles.Arcade.Emitter.html b/docs/Phaser.Particles.Arcade.Emitter.html index b09f7512..875296d9 100644 --- a/docs/Phaser.Particles.Arcade.Emitter.html +++ b/docs/Phaser.Particles.Arcade.Emitter.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1058,7 +1066,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -1376,6 +1384,113 @@ This will have no impact on the rotation value of its children, but it will upda +
    + + + + + + + +
    +

    cameraOffset

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

    If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + +
    @@ -1479,7 +1594,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -1809,6 +1924,119 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/ +
    + + + + + + + +
    +

    fixedToCamera

    + + +
    +
    + +
    +

    A Group that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Group.cameraOffset. +Note that the cameraOffset values are in addition to any parent in the display list. +So if this Group was in a Group that has x: 200, then this will be added to the cameraOffset.x

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

    Set to true to fix this Group to the Camera at its current world coordinates.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + +
    @@ -2431,7 +2659,7 @@ Emitter.emitX and Emitter.emitY control the emission location relative to the x/
    Source:
    @@ -3890,7 +4118,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -3997,7 +4225,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -4206,7 +4434,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -5063,7 +5291,7 @@ that then see the addAt method.

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

    Source:
    @@ -5435,7 +5663,7 @@ The child is added to the Group at the location specified by the index value, th
    Source:
    @@ -5702,7 +5930,7 @@ The child is added to the Group at the location specified by the index value, th
    Source:
    @@ -5941,7 +6169,7 @@ After the method parameter and context you can add as many extra parameters as y
    Source:
    @@ -6139,7 +6367,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -6308,7 +6536,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -6382,7 +6610,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -6479,7 +6707,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -6791,7 +7019,7 @@ Useful if you don't need to create the Sprite instances before-hand.

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

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

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

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

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

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

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

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

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

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

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

    <protected> postUpdate()

    + + +
    +
    + + +
    +

    The core postUpdate - as called by World.

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

    <protected> preUpdate()

    + + +
    +
    + + +
    +

    The core preUpdate - as called by World.

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

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

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

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

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

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

    Source:
    @@ -12823,7 +13199,7 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
    Source:
    @@ -12943,7 +13319,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 Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:24 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Particles.html b/docs/Phaser.Particles.html index 5c788d0f..b3e3d32c 100644 --- a/docs/Phaser.Particles.html +++ b/docs/Phaser.Particles.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1266,7 +1274,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:24 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Physics.Arcade.html b/docs/Phaser.Physics.Arcade.html index 2d301976..eb8e36b8 100644 --- a/docs/Phaser.Physics.Arcade.html +++ b/docs/Phaser.Physics.Arcade.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -591,13 +599,6 @@ -

    Classes

    - -
    -
    Body
    -
    -
    - @@ -3608,7 +3609,7 @@ One way to use this is: accelerationFromRotation(rotation, 200, sprite.accelerat -Phaser.Physics.Arcade.Body +Phaser.Physics.Arcade.Body @@ -5972,7 +5973,7 @@ The second parameter can be an array of objects, of differing types.

    -Phaser.Physics.Arcade.Body +Phaser.Physics.Arcade.Body @@ -6117,7 +6118,7 @@ The second parameter can be an array of objects, of differing types.

    -Phaser.Physics.Arcade.Body +Phaser.Physics.Arcade.Body @@ -6152,7 +6153,7 @@ The second parameter can be an array of objects, of differing types.

    -Phaser.Physics.Arcade.Body +Phaser.Physics.Arcade.Body @@ -6381,7 +6382,7 @@ The second parameter can be an array of objects, of differing types.

    -Phaser.Physics.Arcade.Body +Phaser.Physics.Arcade.Body @@ -6545,7 +6546,7 @@ The second parameter can be an array of objects, of differing types.

    -Phaser.Physics.Arcade.Body +Phaser.Physics.Arcade.Body @@ -7526,7 +7527,7 @@ Objects must expose properties: width, height, left, right, top, bottom.

    -Phaser.Physics.Arcade.Body +Phaser.Physics.Arcade.Body @@ -8097,7 +8098,7 @@ One way to use this is: velocityFromRotation(rotation, 200, sprite.velocity) whi Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:24 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Physics.html b/docs/Phaser.Physics.html index 59c96ebd..1319ae7e 100644 --- a/docs/Phaser.Physics.html +++ b/docs/Phaser.Physics.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -573,7 +581,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:48 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:24 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Plugin.html b/docs/Phaser.Plugin.html index 7d4db35b..b8a7c7d1 100644 --- a/docs/Phaser.Plugin.html +++ b/docs/Phaser.Plugin.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1940,7 +1948,7 @@ It is only called if active is set to true.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:49 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:24 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.PluginManager.html b/docs/Phaser.PluginManager.html index 4dfc6426..1fe7d108 100644 --- a/docs/Phaser.PluginManager.html +++ b/docs/Phaser.PluginManager.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1605,7 +1613,7 @@ It only calls plugins who have active=true.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:49 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:24 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Point.html b/docs/Phaser.Point.html index 4846788a..03dc206f 100644 --- a/docs/Phaser.Point.html +++ b/docs/Phaser.Point.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -5465,7 +5473,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:49 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:24 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Pointer.html b/docs/Phaser.Pointer.html index 70b8cd52..ca7eb31e 100644 --- a/docs/Phaser.Pointer.html +++ b/docs/Phaser.Pointer.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1127,7 +1135,7 @@ The Circle size is 44px (Apples recommended "finger tip" size).

    Source:
    @@ -3093,7 +3101,7 @@ The Circle size is 44px (Apples recommended "finger tip" size).

    Source:
    @@ -3199,7 +3207,7 @@ The Circle size is 44px (Apples recommended "finger tip" size).

    Source:
    @@ -3531,7 +3539,7 @@ If you wish to check if the Pointer was pressed down just once then see the Spri
    Source:
    @@ -3686,7 +3694,7 @@ If you wish to check if the Pointer was released just once then see the Sprite.e
    Source:
    @@ -3833,7 +3841,7 @@ If you wish to check if the Pointer was released just once then see the Sprite.e
    Source:
    @@ -3861,7 +3869,7 @@ If you wish to check if the Pointer was released just once then see the Sprite.e
    -

    move(event)

    +

    move(event, fromClick)

    @@ -3891,8 +3899,12 @@ If you wish to check if the Pointer was released just once then see the Sprite.e Type + Argument + + Default + Description @@ -3922,13 +3934,64 @@ If you wish to check if the Pointer was released just once then see the Sprite.e + + + + + + + + + + + +

    The event passed up from the input handler.

    + + + + fromClick + + + + + +boolean + + + + + + + + + <optional>
    + + + + + + + + + + + + false + + + + +

    Was this called from the click event?

    + + + @@ -4026,7 +4089,7 @@ If you wish to check if the Pointer was released just once then see the Sprite.e
    Source:
    @@ -4268,7 +4331,7 @@ If you wish to check if the Pointer was released just once then see the Sprite.e
    Source:
    @@ -4388,7 +4451,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 Sat Feb 08 2014 07:19:49 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:24 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Polygon.html b/docs/Phaser.Polygon.html index 7797450a..d792276d 100644 --- a/docs/Phaser.Polygon.html +++ b/docs/Phaser.Polygon.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -476,8 +484,8 @@

    Creates a new Polygon. You have to provide a list of points. This can be an array of Points that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], -or the arguments passed can be all the points of the polygon e.g. new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...), or the -arguments passed can be flat x,y values e.g. new PIXI.Polygon(x,y, x,y, x,y, ...) where x and y are numbers.

    +or the arguments passed can be all the points of the polygon e.g. new Phaser.Polygon(new Phaser.Point(), new Phaser.Point(), ...), or the +arguments passed can be flat x,y values e.g. new Phaser.Polygon(x,y, x,y, x,y, ...) where x and y are numbers.

    @@ -562,7 +570,7 @@ arguments passed can be flat x,y values e.g. new PIXI.Polygon(x,y, x,y, x,
    Source:
    @@ -605,6 +613,111 @@ arguments passed can be flat x,y values e.g. new PIXI.Polygon(x,y, x,y, x,
    +
    +

    points

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    points + + +array.<Phaser.Point> +| + +array.<number> + + + +

    The array of Points.

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

    type

    @@ -690,7 +803,7 @@ arguments passed can be flat x,y values e.g. new PIXI.Polygon(x,y, x,y, x,
    Source:
    @@ -709,6 +822,266 @@ arguments passed can be flat x,y values e.g. new PIXI.Polygon(x,y, x,y, x, +

    Methods

    + +
    + +
    +

    clone() → {Phaser.Polygon}

    + + +
    +
    + + +
    +

    Creates a clone of this polygon.

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

    A copy of the polygon.

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Polygon + + +
    +
    + + + + + +
    + + + +
    +

    contains(x, y) → {boolean}

    + + +
    +
    + + +
    +

    Checks whether the x and y coordinates are contained within this polygon.

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

    The X value of the coordinate to test.

    y + + +number + + + +

    The Y value of the coordinate to test.

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

    True if the coordinates are within this polygon, otherwise false.

    +
    + + + +
    +
    + Type +
    +
    + +boolean + + +
    +
    + + + + + +
    + +
    + @@ -733,7 +1106,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 Sat Feb 08 2014 07:19:49 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:25 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.QuadTree.html b/docs/Phaser.QuadTree.html index c848fba7..845733ae 100644 --- a/docs/Phaser.QuadTree.html +++ b/docs/Phaser.QuadTree.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1106,7 +1114,7 @@ Insert the object into the node. If the node exceeds the capacity, it will split -Phaser.Physics.Arcade.Body +Phaser.Physics.Arcade.Body | object @@ -1654,7 +1662,7 @@ Split the node into 4 subnodes

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:49 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:25 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.RandomDataGenerator.html b/docs/Phaser.RandomDataGenerator.html index eb68cbd9..01a07cb2 100644 --- a/docs/Phaser.RandomDataGenerator.html +++ b/docs/Phaser.RandomDataGenerator.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -2071,7 +2079,7 @@ Random number generator from Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:49 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:25 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Rectangle.html b/docs/Phaser.Rectangle.html index ced47c37..55065f57 100644 --- a/docs/Phaser.Rectangle.html +++ b/docs/Phaser.Rectangle.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -7668,7 +7676,7 @@ This method checks the x, y, width, and height properties of the Rectangles.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:25 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.RenderTexture.html b/docs/Phaser.RenderTexture.html index 631e8769..3c3d6226 100644 --- a/docs/Phaser.RenderTexture.html +++ b/docs/Phaser.RenderTexture.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -465,1869 +473,6 @@ -
    -

    new RenderTexture(game, key, width, height)

    - - -
    -
    - - -
    -

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

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    game - - -Phaser.Game - - - -

    Current game instance.

    key - - -string - - - -

    Asset key for the render texture.

    width - - -number - - - -

    the width of the render texture.

    height - - -number - - - -

    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:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - -
    - - - - - - - - - - - - - -

    Class: RenderTexture

    -
    - -
    -

    - Phaser. - - RenderTexture -

    - -

    Phaser.RenderTexture

    - -
    - -
    -
    - - - -

    new RenderTexture(game, key, width, height)

    @@ -2591,210 +736,6 @@ If the display object is a Group or has children it will draw all children as we
    -
    -

    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

    @@ -2889,210 +830,6 @@ If the display object is a Group or has children it will draw all children as we -
    - - - -
    - - - -
    -

    height

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    height - - -number - - - -

    the height.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    indetityMatrix

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    indetityMatrix - - -PIXI.mat3 - - - -

    Matrix object.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - -
    @@ -3195,210 +932,6 @@ If the display object is a Group or has children it will draw all children as we - - - - -
    - - - -
    -

    name

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    name - - -string - - - -

    the name of the object.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    type

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    type - - -number - - - -

    Base Phaser object type.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - -
    @@ -3501,108 +1034,6 @@ If the display object is a Group or has children it will draw all children as we - - - - -
    - - - -
    -

    width

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    width - - -number - - - -

    the width.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - -
    @@ -3613,612 +1044,6 @@ If the display object is a Group or has children it will draw all children as we -

    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:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - -
    - @@ -4243,7 +1068,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 Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:25 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.RequestAnimationFrame.html b/docs/Phaser.RequestAnimationFrame.html index 91a68ab3..0bd6a56c 100644 --- a/docs/Phaser.RequestAnimationFrame.html +++ b/docs/Phaser.RequestAnimationFrame.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1337,7 +1345,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:25 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Signal.html b/docs/Phaser.Signal.html index 28377b51..3d8ef123 100644 --- a/docs/Phaser.Signal.html +++ b/docs/Phaser.Signal.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -2322,7 +2330,7 @@ IMPORTANT: should be called only during signal dispatch, calling it before/after Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:25 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.SinglePad.html b/docs/Phaser.SinglePad.html index f1abb223..404dc332 100644 --- a/docs/Phaser.SinglePad.html +++ b/docs/Phaser.SinglePad.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -3809,7 +3817,7 @@ analog trigger buttons on the XBOX 360 controller

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:25 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Sound.html b/docs/Phaser.Sound.html index f44b1490..a9b127d7 100644 --- a/docs/Phaser.Sound.html +++ b/docs/Phaser.Sound.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -5833,7 +5841,7 @@ This allows you to bundle multiple sounds together into a single audio file and Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:25 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.SoundManager.html b/docs/Phaser.SoundManager.html index 1c61d2bf..9ebe0ce9 100644 --- a/docs/Phaser.SoundManager.html +++ b/docs/Phaser.SoundManager.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -2891,7 +2899,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 Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:26 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Sprite.html b/docs/Phaser.Sprite.html index 740daa40..8ad6daec 100644 --- a/docs/Phaser.Sprite.html +++ b/docs/Phaser.Sprite.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -657,11404 +665,6 @@ 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:
    • gameobjects/Sprite.js, line 23 @@ -12100,219 +710,6 @@ events (via Sprite.events), animation (via Sprite.animations), camera culling an
      -
      -

      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

      @@ -12375,7 +772,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -

      The angle of this Image in degrees.

      +

      The angle of this Sprite in degrees.

      @@ -12404,7 +801,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
      Source:
      @@ -12506,219 +903,7 @@ 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:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    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:
    -
    @@ -12829,7 +1014,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun
    Source:
    @@ -12892,7 +1077,10 @@ Be advised this is quite an expensive operation, as it has to calculate the boun -Phaser.Physics.Arcade.Body +Phaser.Physics.Body +| + +null @@ -12902,7 +1090,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun -

    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.

    +

    The Sprites physics Body. Will be null unless physics has been enabled via Sprite.physicsEnabled = true.

    @@ -12931,421 +1119,7 @@ Be advised this is quite an expensive operation, as it has to calculate the boun
    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:
    -
    @@ -13418,7 +1192,7 @@ It's used for Camera culling and physics body alignment.

    -

    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.

    +

    If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.

    @@ -13447,7 +1221,7 @@ It's used for Camera culling and physics body alignment.

    Source:
    @@ -13465,117 +1239,16 @@ It's used for Camera culling and physics body alignment.

    -

    center

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    center - - -Phaser.Point - - - -

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

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    crop

    +

    checkWorldBounds

    -

    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.

    +

    If true the Sprite checks if it is still within the world each frame, when it leaves the world it dispatches Sprite.events.onOutOfBounds +and optionally kills the sprite (if Sprite.outOfBoundsKill is true). By default this is disabled because the Sprite has to calculate its +bounds every frame to support it, and not all games need it. Enable it by setting the value to true.

    @@ -13611,109 +1284,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    - crop - - - - - -Phaser.Rectangle - - - - - - - - - -

    The crop Rectangle applied to the Sprite texture before rendering.

    - - - - - -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    cropEnabled

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -13761,109 +1332,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    - - - - - - - - - - - - - - - -
    -

    currentFrame

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - -
    NameTypeDescription
    cropEnabledcheckWorldBounds @@ -13729,7 +1300,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -

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

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    currentFrame - - -Phaser.Frame - - - -

    A reference to the currently displayed frame.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -13968,112 +1437,7 @@ 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:
    -
    @@ -14179,7 +1543,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -14285,7 +1649,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -14391,7 +1755,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    Source:
    @@ -14493,109 +1857,7 @@ 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:
    -
    @@ -14619,6 +1881,12 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    +
    +

    Sprite.exists controls if the core game loop and physics update this Sprite or not. +When you set Sprite.exists to false it will remove its Body from the physics world (if it has one) and also set Sprite.visible to false. +Setting Sprite.exists to true will re-add the Body to the physics world (if it has a body) and set Sprite.visible to true.

    +
    + @@ -14668,7 +1936,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -

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

    +

    If the Sprite is processed by the core game update and physics.

    @@ -14693,119 +1961,11 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -
    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:
    -
    @@ -14830,7 +1990,9 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -

    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.

    +

    An Sprite that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Sprite.cameraOffset. +Note that the cameraOffset values are in addition to any parent in the display list. +So if this Sprite was in a Group that has x: 200, then this will be added to the cameraOffset.x

    @@ -14882,7 +2044,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -

    Fixes this Sprite to the Camera.

    +

    Set to true to fix this Sprite to the Camera at its current world coordinates.

    @@ -14907,124 +2069,11 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -
    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:
    -
    @@ -15126,109 +2175,7 @@ Note that if this Image is a child of a display object that has changed its posi
    Source:
    - - - - - - - -
    - - - -
    - - - -
    -

    frame

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    frame - - -number - - - -

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

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -15330,211 +2277,7 @@ Note that if this Image is a child of a display object that has changed its posi
    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:
    -
    @@ -15738,318 +2481,7 @@ Note that if this Image is a child of a display object that has changed its posi
    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:
    -
    @@ -16074,7 +2506,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    -

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

    +

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

    @@ -16126,7 +2558,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    -

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

    +

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

    @@ -16155,109 +2587,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    - - - - - - - -
    - - - -
    - - - -
    -

    input

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    input - - -Phaser.InputHandler - - - -

    The Input Handler Component.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -16362,7 +2692,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    Source:
    @@ -16388,113 +2718,6 @@ If you wish to crop the Sprite instead see the Sprite.crop 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.

    -
    - - - - - -
    - - -
    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.

    @@ -16576,109 +2799,7 @@ activated for this object and it will then start to process click/touch events a
    Source:
    - - - - - - - - - - - - - - - -
    -

    inWorld

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    inWorld - - -boolean - - - -

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

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -16703,7 +2824,7 @@ activated for this object and it will then start to process click/touch events a
    -

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

    +

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

    @@ -16755,7 +2876,7 @@ activated for this object and it will then start to process click/touch events a -

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

    +

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

    @@ -16784,112 +2905,7 @@ activated for this object and it will then start to process click/touch events a
    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:
    -
    @@ -17000,118 +3016,7 @@ activated for this object and it will then start to process click/touch events a
    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:
    -
    @@ -17221,7 +3126,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    @@ -17239,15 +3144,225 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    -

    lifespan

    +

    name

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

    The user defined name given to this Sprite.

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

    outOfBoundsKill

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    outOfBoundsKill + + +boolean + + + +

    If true Sprite.kill is called as soon as Sprite.inWorld returns false, as long as Sprite.checkWorldBounds is true.

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

    physicsEnabled

    -

    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.

    +

    By default Sprites won't add themselves to the physics world. By setting physicsEnabled to true a Rectangle physics body is +attached to this Sprite matching its placement and dimensions, and will then start to process physics world updates. +You can access all physics related properties via Sprite.body.

    +

    Important: Enabling a Sprite for physics will automatically set Sprite.anchor to 0.5 s0 the physics body is centered on the Sprite. +If you need a different result then adjust or re-create the Body shape offsets manually, and/or reset the anchor after enabling physics.

    @@ -17283,418 +3398,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze - 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
    outOfBoundsKillphysicsEnabled @@ -17710,217 +3414,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze -

    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:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -17949,7 +3443,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    @@ -18051,317 +3545,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    Source:
    - - - - - - - - - - - - - - - -
    -

    textureRegion

    - - -
    -
    - -
    -

    The rectangular area from the texture that will be rendered.

    -
    - - - - - -
    - - -
    Properties:
    - -
    - -
    NameTypeDescription
    renderOrderID - - -number - - - -

    Used by the Renderer and Input Manager to control picking order.

    Set to true to add this Sprite to the physics world. Set to false to destroy the body and remove it from the physics world.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    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:
    -
    @@ -18463,216 +3647,7 @@ 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:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    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:
    -
    @@ -18774,517 +3749,7 @@ 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:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    <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:
    -
    @@ -19350,241 +3815,7 @@ 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:
    -
    @@ -19631,8 +3862,8 @@ Doesn't change the anchor point of the sprite.

    -

    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.

    +

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

    @@ -19682,7 +3913,7 @@ Cropping takes place from the top-left of the Image and can be modified in real- -

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

    +

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

    @@ -19714,7 +3945,7 @@ Cropping takes place from the top-left of the Image and can be modified in real-
    Source:
    @@ -19833,7 +4064,7 @@ If health is then taken below zero Sprite.kill is called.

    Source:
    @@ -19867,320 +4098,6 @@ If health is then taken below zero Sprite.kill is called.

    -
    - - - -
    -

    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 - - -
    -
    - - - - -
    @@ -20227,7 +4144,7 @@ If health is then taken below zero Sprite.kill is called.

    Source:
    @@ -20297,77 +4214,7 @@ 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:
    -
    @@ -20437,7 +4284,7 @@ Draws a {Phaser.Polygon} or a {PIXI.Polygon} filled

    Source:
    @@ -20460,382 +4307,6 @@ Draws a {Phaser.Polygon} or a {PIXI.Polygon} filled

    -
    - - - -
    -

    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 - - -
    -
    - - - - -
    @@ -20885,90 +4356,7 @@ 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:
    -
    @@ -21133,161 +4521,7 @@ 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:
    -
    @@ -21539,282 +4773,7 @@ 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:
    -
    @@ -21906,7 +4865,7 @@ If the requested animation is already playing this request will be ignored. If y
    Source:
    @@ -21934,145 +4893,7 @@ If the requested animation is already playing this request will be ignored. If y
    -

    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()

    +

    preUpdate() → {boolean}

    @@ -22113,217 +4934,7 @@ If the requested animation is already playing this request will be ignored. If y
    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:
    -
    @@ -22348,11 +4959,23 @@ If the Sprite has a physics body that too is reset.

    -

    (Phaser.Sprite) This instance.

    +

    True if the Sprite was rendered, otherwise false.

    +
    +
    + Type +
    +
    + +boolean + + +
    +
    + @@ -22544,227 +5167,7 @@ If the Sprite has a physics body that too is reset.

    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:
    -
    @@ -22915,7 +5318,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    @@ -22954,7 +5357,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    -

    updateAnimation()

    +

    update()

    @@ -22962,7 +5365,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    -

    Internal function called by preUpdate.

    +

    Override and use this function in your own custom objects to handle any update requirements you may have.

    @@ -22995,214 +5398,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    updateBounds()

    - - -
    -
    - - -
    -

    Internal function called by preUpdate.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    updateCache()

    - - -
    -
    - - -
    -

    Internal function called by preUpdate.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    updateCrop()

    - - -
    -
    - - -
    -

    Internal function called by preUpdate.

    -
    - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -23253,7 +5449,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:50 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:26 GMT-0000 (GMT) using the DocStrap template.
    diff --git a/docs/Phaser.SpriteBatch.html b/docs/Phaser.SpriteBatch.html new file mode 100644 index 00000000..ef6b546d --- /dev/null +++ b/docs/Phaser.SpriteBatch.html @@ -0,0 +1,9214 @@ + + + + + + Phaser Class: SpriteBatch + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Class: SpriteBatch

    +
    + +
    +

    + Phaser. + + SpriteBatch +

    + +

    Phaser.SpriteBatch

    + +
    + +
    +
    + + + + +
    +

    new SpriteBatch(game, parent, name, addToStage)

    + + +
    +
    + + +
    +

    Phaser SpriteBatch constructor.

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

    A reference to the currently running game.

    parent + + +Phaser.Group +| + +Phaser.Sprite + + + + + + + + + + + +

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

    name + + +string + + + + + + <optional>
    + + + + + +
    + + group + +

    A name for this Group. Not used internally but useful for debugging.

    addToStage + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    If set to true this Group will be added directly to the Game.Stage instead of Game.World.

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

    Extends

    + + + + + + + + + + + + + +

    Members

    + +
    + +
    +

    alive

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

    The alive property is useful for Groups that are children of other Groups and need to be included/excluded in checks like forEachAlive.

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

    alpha

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    alpha + + +number + + + +

    The alpha value of the Group container.

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

    angle

    + + +
    +
    + +
    +

    The angle of rotation of the Group container. This will adjust the Group container itself by modifying its rotation. +This will have no impact on the rotation value of its children, but it will update their worldTransform and on-screen position.

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

    The angle of rotation given in degrees, where 0 degrees = to the right.

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

    cameraOffset

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

    If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.

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

    cursor

    + + +
    +
    + +
    +

    The cursor is a simple way to iterate through the objects in a Group using the Group.next and Group.previous functions. +The cursor is set to the first child added to the Group and doesn't change unless you call next, previous or set it directly with Group.cursor.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    cursor + + +any + + + +

    The current display object that the Group cursor is pointing to.

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

    exists

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

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

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

    fixedToCamera

    + + +
    +
    + +
    +

    A Group that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Group.cameraOffset. +Note that the cameraOffset values are in addition to any parent in the display list. +So if this Group was in a Group that has x: 200, then this will be added to the cameraOffset.x

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

    Set to true to fix this Group to the Camera at its current world coordinates.

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

    game

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

    A reference to the currently running Game.

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

    <readonly> length

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    length + + +number + + + +

    The total number of children in this Group, regardless of their exists/alive status.

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

    name

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

    A name for this Group. Not used internally but useful for debugging.

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

    rotation

    + + +
    +
    + +
    +

    The angle of rotation of the Group container. This will adjust the Group container itself by modifying its rotation. +This will have no impact on the rotation value of its children, but it will update their worldTransform and on-screen position.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    rotation + + +number + + + +

    The angle of rotation given in radians.

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

    scale

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    scale + + +Phaser.Point + + + +

    The scale of the Group container.

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

    <readonly> total

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    total + + +number + + + +

    The total number of children in this Group who have a state of exists = true.

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

    <protected> type

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

    Internal Phaser Type value.

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

    visible

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    visible + + +boolean + + + +

    The visible state of the Group. Non-visible Groups and all of their children are not rendered.

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

    x

    + + +
    +
    + +
    +

    The x coordinate of the Group container. You can adjust the Group container itself by modifying its coordinates. +This will have no impact on the x/y coordinates of its children, but it will update their worldTransform and on-screen position.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    x + + +number + + + +

    The x coordinate of the Group container.

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

    y

    + + +
    +
    + +
    +

    The y coordinate of the Group container. You can adjust the Group container itself by modifying its coordinates. +This will have no impact on the x/y coordinates of its children, but it will update their worldTransform and on-screen position.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    y + + +number + + + +

    The y coordinate of the Group container.

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

    Methods

    + +
    + +
    +

    add(child) → {*}

    + + +
    +
    + + +
    +

    Adds an existing object to this Group. The object can be an instance of Phaser.Sprite, Phaser.Button or any other display object. +The child is automatically added to the top of the Group, so renders on-top of everything else within the Group. If you need to control +that then see the addAt method.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    child + + +* + + + +

    An instance of Phaser.Sprite, Phaser.Button or any other display object..

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

    The child that was added to the Group.

    +
    + + + +
    +
    + Type +
    +
    + +* + + +
    +
    + + + + + +
    + + + +
    +

    addAll(property, amount, checkAlive, checkVisible)

    + + +
    +
    + + +
    +

    Adds the amount to the given property on all children in this Group. +Group.addAll('x', 10) will add 10 to the child.x value.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    property + + +string + + + +

    The property to increment, for example 'body.velocity.x' or 'angle'.

    amount + + +number + + + +

    The amount to increment the property by. If child.x = 10 then addAll('x', 40) would make child.x = 50.

    checkAlive + + +boolean + + + +

    If true the property will only be changed if the child is alive.

    checkVisible + + +boolean + + + +

    If true the property will only be changed if the child is visible.

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

    addAt(child, index) → {*}

    + + +
    +
    + + +
    +

    Adds an existing object to this Group. The object can be an instance of Phaser.Sprite, Phaser.Button or any other display object. +The child is added to the Group at the location specified by the index value, this allows you to control child ordering.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    child + + +* + + + +

    An instance of Phaser.Sprite, Phaser.Button or any other display object..

    index + + +number + + + +

    The index within the Group to insert the child to.

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

    The child that was added to the Group.

    +
    + + + +
    +
    + Type +
    +
    + +* + + +
    +
    + + + + + +
    + + + +
    +

    bringToTop(child) → {*}

    + + +
    +
    + + +
    +

    Brings the given child to the top of this Group so it renders above all other children.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    child + + +* + + + +

    The child to bring to the top of this Group.

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

    The child that was moved.

    +
    + + + +
    +
    + Type +
    +
    + +* + + +
    +
    + + + + + +
    + + + +
    +

    callAll(method, context, parameter)

    + + +
    +
    + + +
    +

    Calls a function on all of the children regardless if they are dead or alive (see callAllExists if you need control over that) +After the method parameter and context you can add as many extra parameters as you like, which will all be passed to the child.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    method + + +string + + + + + + + + + + + +

    A string containing the name of the function that will be called. The function must exist on the child.

    context + + +string + + + + + + <optional>
    + + + + + +
    + + null + +

    A string containing the context under which the method will be executed. Set to null to default to the child.

    parameter + + +* + + + + + + + + + + <repeatable>
    + +
    + +

    Additional parameters that will be passed to the method.

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

    callAllExists(callback, existsValue, parameter)

    + + +
    +
    + + +
    +

    Calls a function on all of the children that have exists=true in this Group. +After the existsValue parameter you can add as many parameters as you like, which will all be passed to the child callback.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    callback + + +function + + + + + + + + + +

    The function that exists on the children that will be called.

    existsValue + + +boolean + + + + + + + + + +

    Only children with exists=existsValue will be called.

    parameter + + +* + + + + + + + + + + <repeatable>
    + +

    Additional parameters that will be passed to the callback.

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

    <protected> callbackFromArray(child, callback, length)

    + + +
    +
    + + +
    +

    Returns a reference to a function that exists on a child of the Group based on the given callback array.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    child + + +object + + + +

    The object to inspect.

    callback + + +array + + + +

    The array of function names.

    length + + +number + + + +

    The size of the array (pre-calculated in callAll).

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

    countDead() → {number}

    + + +
    +
    + + +
    +

    Call this function to find out how many members of the group are dead.

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

    The number of children flagged as dead.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    countLiving() → {number}

    + + +
    +
    + + +
    +

    Call this function to find out how many members of the group are alive.

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

    The number of children flagged as alive.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    create(x, y, key, frame, exists) → {Phaser.Sprite}

    + + +
    +
    + + +
    +

    Automatically creates a new Phaser.Sprite object and adds it to the top of this Group. +Useful if you don't need to create the Sprite instances before-hand.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    x + + +number + + + + + + + + + + + +

    The x coordinate to display the newly created Sprite at. The value is in relation to the Group.x point.

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

    The y coordinate to display the newly created Sprite at. The value is in relation to the Group.y point.

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

    The Game.cache key of the image that this Sprite will use.

    frame + + +number +| + +string + + + + + + <optional>
    + + + + + +
    + +

    If the Sprite image contains multiple frames you can specify which one to use here.

    exists + + +boolean + + + + + + <optional>
    + + + + + +
    + + true + +

    The default exists state of the Sprite.

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

    The child that was created.

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

    createMultiple(quantity, key, frame, exists)

    + + +
    +
    + + +
    +

    Automatically creates multiple Phaser.Sprite objects and adds them to the top of this Group. +Useful if you need to quickly generate a pool of identical sprites, such as bullets. By default the sprites will be set to not exist +and will be positioned at 0, 0 (relative to the Group.x/y)

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    quantity + + +number + + + + + + + + + + + +

    The number of Sprites to create.

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

    The Game.cache key of the image that this Sprite will use.

    frame + + +number +| + +string + + + + + + <optional>
    + + + + + +
    + +

    If the Sprite image contains multiple frames you can specify which one to use here.

    exists + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    The default exists state of the Sprite.

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

    destroy(destroyChildren)

    + + +
    +
    + + +
    +

    Destroys this Group. Removes all children, then removes the container from the display list and nulls references.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    destroyChildren + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    Should every child of this Group have its destroy method called?

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

    divideAll(property, amount, checkAlive, checkVisible)

    + + +
    +
    + + +
    +

    Divides the given property by the amount on all children in this Group. +Group.divideAll('x', 2) will half the child.x value.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    property + + +string + + + +

    The property to divide, for example 'body.velocity.x' or 'angle'.

    amount + + +number + + + +

    The amount to divide the property by. If child.x = 100 then divideAll('x', 2) would make child.x = 50.

    checkAlive + + +boolean + + + +

    If true the property will only be changed if the child is alive.

    checkVisible + + +boolean + + + +

    If true the property will only be changed if the child is visible.

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

    forEach(callback, callbackContext, checkExists)

    + + +
    +
    + + +
    +

    Allows you to call your own function on each member of this Group. You must pass the callback and context in which it will run. +After the checkExists parameter you can add as many parameters as you like, which will all be passed to the callback along with the child. +For example: Group.forEach(awardBonusGold, this, true, 100, 500) +Note: Currently this will skip any children which are Groups themselves.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    callback + + +function + + + +

    The function that will be called. Each child of the Group will be passed to it as its first parameter.

    callbackContext + + +Object + + + +

    The context in which the function should be called (usually 'this').

    checkExists + + +boolean + + + +

    If set only children with exists=true will be passed to the callback, otherwise all children will be passed.

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

    forEachAlive(callback, callbackContext)

    + + +
    +
    + + +
    +

    Allows you to call your own function on each alive member of this Group (where child.alive=true). You must pass the callback and context in which it will run. +You can add as many parameters as you like, which will all be passed to the callback along with the child. +For example: Group.forEachAlive(causeDamage, this, 500)

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    callback + + +function + + + +

    The function that will be called. Each child of the Group will be passed to it as its first parameter.

    callbackContext + + +Object + + + +

    The context in which the function should be called (usually 'this').

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

    forEachAlive(callback, callbackContext)

    + + +
    +
    + + +
    +

    Allows you to call your own function on each alive member of this Group (where child.alive=true). You must pass the callback and context in which it will run. +You can add as many parameters as you like, which will all be passed to the callback along with the child. +For example: Group.forEachAlive(causeDamage, this, 500)

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    callback + + +function + + + +

    The function that will be called. Each child of the Group will be passed to it as its first parameter.

    callbackContext + + +Object + + + +

    The context in which the function should be called (usually 'this').

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

    forEachDead(callback, callbackContext)

    + + +
    +
    + + +
    +

    Allows you to call your own function on each dead member of this Group (where alive=false). You must pass the callback and context in which it will run. +You can add as many parameters as you like, which will all be passed to the callback along with the child. +For example: Group.forEachDead(bringToLife, this)

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    callback + + +function + + + +

    The function that will be called. Each child of the Group will be passed to it as its first parameter.

    callbackContext + + +Object + + + +

    The context in which the function should be called (usually 'this').

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

    getAt(index) → {*}

    + + +
    +
    + + +
    +

    Returns the child found at the given index within this Group.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    index + + +number + + + +

    The index to return the child from.

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

    The child that was found at the given index.

    +
    + + + +
    +
    + Type +
    +
    + +* + + +
    +
    + + + + + +
    + + + +
    +

    getFirstAlive() → {Any}

    + + +
    +
    + + +
    +

    Call this function to retrieve the first object with alive === true in the group. +This is handy for checking if everything has been wiped out, or choosing a squad leader, etc.

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

    The first alive child, or null if none found.

    +
    + + + +
    +
    + Type +
    +
    + +Any + + +
    +
    + + + + + +
    + + + +
    +

    getFirstDead() → {Any}

    + + +
    +
    + + +
    +

    Call this function to retrieve the first object with alive === false in the group. +This is handy for checking if everything has been wiped out, or choosing a squad leader, etc.

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

    The first dead child, or null if none found.

    +
    + + + +
    +
    + Type +
    +
    + +Any + + +
    +
    + + + + + +
    + + + +
    +

    getFirstExists(state) → {Any}

    + + +
    +
    + + +
    +

    Call this function to retrieve the first object with exists == (the given state) in the Group.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    state + + +boolean + + + +

    True or false.

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

    The first child, or null if none found.

    +
    + + + +
    +
    + Type +
    +
    + +Any + + +
    +
    + + + + + +
    + + + +
    +

    getIndex(child) → {number}

    + + +
    +
    + + +
    +

    Get the index position of the given child in this Group.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    child + + +* + + + +

    The child to get the index for.

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

    The index of the child or -1 if it's not a member of this Group.

    +
    + + + +
    +
    + Type +
    +
    + +number + + +
    +
    + + + + + +
    + + + +
    +

    getRandom(startIndex, length) → {Any}

    + + +
    +
    + + +
    +

    Returns a member at random from the group.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    startIndex + + +number + + + +

    Optional offset off the front of the array. Default value is 0, or the beginning of the array.

    length + + +number + + + +

    Optional restriction on the number of values you want to randomly select from.

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

    A random child of this Group.

    +
    + + + +
    +
    + Type +
    +
    + +Any + + +
    +
    + + + + + +
    + + + +
    +

    iterate(key, value, returnType, callback, callbackContext) → {any}

    + + +
    +
    + + +
    +

    Iterates over the children of the Group. When a child has a property matching key that equals the given value, it is considered as a match. +Matched children can be sent to the optional callback, or simply returned or counted. +You can add as many callback parameters as you like, which will all be passed to the callback along with the child, after the callbackContext parameter.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    key + + +string + + + + + + + + + + + +

    The child property to check, i.e. 'exists', 'alive', 'health'

    value + + +any + + + + + + + + + + + +

    If child.key === this value it will be considered a match. Note that a strict comparison is used.

    returnType + + +number + + + + + + + + + + + +

    How to return the data from this method. Either Phaser.Group.RETURN_NONE, Phaser.Group.RETURN_TOTAL or Phaser.Group.RETURN_CHILD.

    callback + + +function + + + + + + <optional>
    + + + + + +
    + + null + +

    Optional function that will be called on each matching child. Each child of the Group will be passed to it as its first parameter.

    callbackContext + + +Object + + + + + + <optional>
    + + + + + +
    + +

    The context in which the function should be called (usually 'this').

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

    Returns either a numeric total (if RETURN_TOTAL was specified) or the child object.

    +
    + + + +
    +
    + Type +
    +
    + +any + + +
    +
    + + + + + +
    + + + +
    +

    multiplyAll(property, amount, checkAlive, checkVisible)

    + + +
    +
    + + +
    +

    Multiplies the given property by the amount on all children in this Group. +Group.multiplyAll('x', 2) will x2 the child.x value.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    property + + +string + + + +

    The property to multiply, for example 'body.velocity.x' or 'angle'.

    amount + + +number + + + +

    The amount to multiply the property by. If child.x = 10 then multiplyAll('x', 2) would make child.x = 20.

    checkAlive + + +boolean + + + +

    If true the property will only be changed if the child is alive.

    checkVisible + + +boolean + + + +

    If true the property will only be changed if the child is visible.

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

    next()

    + + +
    +
    + + +
    +

    Advances the Group cursor to the next object in the Group. If it's at the end of the Group it wraps around to the first object.

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

    <protected> postUpdate()

    + + +
    +
    + + +
    +

    The core postUpdate - as called by World.

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

    <protected> preUpdate()

    + + +
    +
    + + +
    +

    The core preUpdate - as called by World.

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

    previous()

    + + +
    +
    + + +
    +

    Moves the Group cursor to the previous object in the Group. If it's at the start of the Group it wraps around to the last object.

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

    remove(child) → {boolean}

    + + +
    +
    + + +
    +

    Removes the given child from this Group and sets its group property to null.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    child + + +Any + + + +

    The child to remove.

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

    true if the child was removed from this Group, otherwise false.

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

    removeAll()

    + + +
    +
    + + +
    +

    Removes all children from this Group, setting all group properties to null. +The Group container remains on the display list.

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

    removeBetween(startIndex, endIndex)

    + + +
    +
    + + +
    +

    Removes all children from this Group whos index falls beteen the given startIndex and endIndex values.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    startIndex + + +number + + + +

    The index to start removing children from.

    endIndex + + +number + + + +

    The index to stop removing children from. Must be higher than startIndex and less than the length of the Group.

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

    replace(oldChild, newChild)

    + + +
    +
    + + +
    +

    Replaces a child of this Group with the given newChild. The newChild cannot be a member of this Group.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    oldChild + + +* + + + +

    The child in this Group that will be replaced.

    newChild + + +* + + + +

    The child to be inserted into this group.

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

    set(child, key, value, checkAlive, checkVisible, operation)

    + + +
    +
    + + +
    +

    This function allows you to quickly set a property on a single child of this Group to a new value. +The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    child + + +Phaser.Sprite + + + + + + + + + + + +

    The child to set the property on.

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

    The property, as a string, to be set. For example: 'body.velocity.x'

    value + + +* + + + + + + + + + + + +

    The value that will be set.

    checkAlive + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    If set then the child will only be updated if alive=true.

    checkVisible + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    If set then the child will only be updated if visible=true.

    operation + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it.

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

    setAll(key, value, checkAlive, checkVisible, operation)

    + + +
    +
    + + +
    +

    This function allows you to quickly set the same property across all children of this Group to a new value. +The operation parameter controls how the new value is assigned to the property, from simple replacement to addition and multiplication.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    key + + +string + + + + + + + + + + + +

    The property, as a string, to be set. For example: 'body.velocity.x'

    value + + +* + + + + + + + + + + + +

    The value that will be set.

    checkAlive + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    If set then only children with alive=true will be updated.

    checkVisible + + +boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    If set then only children with visible=true will be updated.

    operation + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it.

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

    setProperty(child, key, value, operation)

    + + +
    +
    + + +
    +

    Sets the given property to the given value on the child. The operation controls the assignment of the value.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    child + + +* + + + + + + + + + + + +

    The child to set the property value on.

    key + + +array + + + + + + + + + + + +

    An array of strings that make up the property that will be set.

    value + + +* + + + + + + + + + + + +

    The value that will be set.

    operation + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    Controls how the value is assigned. A value of 0 replaces the value with the new one. A value of 1 adds it, 2 subtracts it, 3 multiplies it and 4 divides it.

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

    sort(index, order)

    + + +
    +
    + + +
    +

    Call this function to sort the group according to a particular value and order. +For example to depth sort Sprites for Zelda-style game you might call group.sort('y', Phaser.Group.SORT_ASCENDING) at the bottom of your State.update().

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    index + + +string + + + + + + <optional>
    + + + + + +
    + + 'y' + +

    The string name of the property you want to sort on.

    order + + +number + + + + + + <optional>
    + + + + + +
    + + Phaser.Group.SORT_ASCENDING + +

    The Group constant that defines the sort order. Possible values are Phaser.Group.SORT_ASCENDING and Phaser.Group.SORT_DESCENDING.

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

    subAll(property, amount, checkAlive, checkVisible)

    + + +
    +
    + + +
    +

    Subtracts the amount from the given property on all children in this Group. +Group.subAll('x', 10) will minus 10 from the child.x value.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    property + + +string + + + +

    The property to decrement, for example 'body.velocity.x' or 'angle'.

    amount + + +number + + + +

    The amount to subtract from the property. If child.x = 50 then subAll('x', 40) would make child.x = 10.

    checkAlive + + +boolean + + + +

    If true the property will only be changed if the child is alive.

    checkVisible + + +boolean + + + +

    If true the property will only be changed if the child is visible.

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

    swap(child1, child2)

    + + +
    +
    + + +
    +

    Swaps the position of two children in this Group. Both children must be in this Group. +You cannot swap a child with itself, or swap un-parented children, doing so will return false.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    child1 + + +* + + + +

    The first child to swap.

    child2 + + +* + + + +

    The second child to swap.

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

    <protected> update()

    + + +
    +
    + + +
    +

    The core update - as called by World.

    +
    + + + + + + + + + +
    + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + + +
    + + + + + + + + + + + + + +
    + +
    + + + + + +
    + +
    + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2014 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.3.0-dev + on Tue Feb 18 2014 03:01:26 GMT-0000 (GMT) using the DocStrap template. + +
    +
    + + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/Phaser.Stage.html b/docs/Phaser.Stage.html index c3a06801..a6c4a1ae 100644 --- a/docs/Phaser.Stage.html +++ b/docs/Phaser.Stage.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -603,7 +611,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
    Source:
    @@ -632,6 +640,12 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree +

    Extends

    + +
      +
    • PIXI.Stage
    • +
    + @@ -646,108 +660,6 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
    -
    -

    aspectRatio

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    aspectRatio - - -number - - - -

    Aspect ratio.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - -

    backgroundColor

    @@ -836,109 +748,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
    Source:
    - - - - - - - -
    - - - - - - - -
    -

    canvas

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    canvas - - -HTMLCanvasElement - - - -

    Reference to the newly created canvas element.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -1046,7 +856,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
    Source:
    @@ -1151,7 +961,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
    Source:
    @@ -1169,7 +979,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
    -

    display

    +

    exists

    @@ -1208,13 +1018,13 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree - display + exists -PIXI.Stage +boolean @@ -1224,7 +1034,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree -

    The Pixi Stage which is hooked to the renderer.

    +

    If exists is true the Stage and all children are updated, otherwise it is skipped.

    @@ -1249,11 +1059,14 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree +
    Default Value:
    +
    • true
    +
    Source:
    @@ -1355,7 +1168,112 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    name

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

    The name of this object.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • "_stage_root"
    + + + +
    Source:
    +
    @@ -1428,7 +1346,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree -

    Get the offset values (for input and other things).

    +

    Holds the offset coordinates of the Game.canvas from the top-left of the browser window (used by Input and other classes)

    @@ -1457,7 +1375,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
    Source:
    @@ -1475,12 +1393,16 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
    -

    scale

    +

    setBackgroundColor

    +
    +

    Sets the background color for the stage.

    +
    + @@ -1488,58 +1410,6 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
    -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    scale - - -Phaser.StageScaleMode - - - -

    The scale of the current running game.

    -
    - - - @@ -1559,109 +1429,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
    Source:
    - - - - - - - -
    - - - -
    - - - -
    -

    scaleMode

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    scaleMode - - -number - - - -

    The current scaleMode.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -1726,7 +1494,218 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    postUpdate()

    + + +
    +
    + + +
    +

    This is called automatically before the renderer runs and after the plugins have updated. +In postUpdate this is where all the final physics calculatations and object positioning happens. +The objects are processed in the order of the display list. +The only exception to this is if the camera is following an object, in which case that is updated first.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    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 and positioning is done.

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

    update()

    + + +
    +
    + + +
    +

    This is called automatically after the State.update, but before particles or plugins update.

    +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1795,7 +1774,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
    Source:
    @@ -1913,7 +1892,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree
    Source:
    @@ -1964,7 +1943,7 @@ focus handling, game resizing, scaling and the pause, boot and orientation scree Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:51 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:26 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.StageScaleMode.html b/docs/Phaser.StageScaleMode.html index 539c7496..1342af2c 100644 --- a/docs/Phaser.StageScaleMode.html +++ b/docs/Phaser.StageScaleMode.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -688,7 +696,7 @@
    Source:
    @@ -748,7 +756,7 @@
    Source:
    @@ -808,7 +816,7 @@
    Source:
    @@ -826,7 +834,7 @@
    -

    aspectRatio

    +

    <readonly> aspectRatio

    @@ -881,7 +889,7 @@ -

    Aspect ratio.

    +

    The aspect ratio of the scaled game.

    @@ -906,14 +914,11 @@ -
    Default Value:
    -
    • 0
    -
    Source:
    @@ -1015,7 +1020,7 @@
    Source:
    @@ -1117,7 +1122,7 @@
    Source:
    @@ -1219,7 +1224,7 @@
    Source:
    @@ -1321,7 +1326,7 @@
    Source:
    @@ -1426,7 +1431,7 @@
    Source:
    @@ -1531,7 +1536,7 @@
    Source:
    @@ -1735,7 +1740,7 @@
    Source:
    @@ -1942,7 +1947,7 @@
    Source:
    @@ -2044,7 +2049,7 @@
    Source:
    @@ -2146,7 +2151,7 @@
    Source:
    @@ -2248,7 +2253,7 @@
    Source:
    @@ -2350,7 +2355,7 @@
    Source:
    @@ -2452,7 +2457,7 @@
    Source:
    @@ -2525,8 +2530,7 @@ -

    Maximum height the canvas should be scaled to (in pixels). -If null it will scale to whatever height the browser can handle.

    +

    Maximum height the canvas should be scaled to (in pixels). If null it will scale to whatever height the browser can handle.

    @@ -2551,14 +2555,11 @@ If null it will scale to whatever height the browser can handle.

    -
    Default Value:
    -
    • null
    -
    Source:
    @@ -2663,7 +2664,7 @@ If null it will scale to whatever height the browser can handle.

    Source:
    @@ -2736,8 +2737,7 @@ If null it will scale to whatever height the browser can handle.

    -

    Maximum width the canvas should be scaled to (in pixels). -If null it will scale to whatever width the browser can handle.

    +

    Maximum width the canvas should be scaled to (in pixels). If null it will scale to whatever width the browser can handle.

    @@ -2762,14 +2762,11 @@ If null it will scale to whatever width the browser can handle.

    -
    Default Value:
    -
    • null
    -
    Source:
    @@ -2867,14 +2864,11 @@ If null it will scale to whatever width the browser can handle.

    -
    Default Value:
    -
    • null
    -
    Source:
    @@ -2972,14 +2966,113 @@ If null it will scale to whatever width the browser can handle.

    -
    Default Value:
    -
    • null
    + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    orientation

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    orientation + + +number + + + +

    The orientation value of the game (as defined by window.orientation if set). 90 = landscape. 0 = portrait.

    +
    + + + + + + + + + + + + + + + + +
    Source:
    @@ -3077,14 +3170,11 @@ If null it will scale to whatever width the browser can handle.

    -
    Default Value:
    -
    • null
    -
    Source:
    @@ -3191,7 +3281,7 @@ It doesn't care about any other DOM element that may be on the page, it literall
    Source:
    @@ -3298,7 +3388,7 @@ It doesn't care about any other DOM element that may be on the page, it literall
    Source:
    @@ -3400,7 +3490,7 @@ It doesn't care about any other DOM element that may be on the page, it literall
    Source:
    @@ -3502,7 +3592,211 @@ It doesn't care about any other DOM element that may be on the page, it literall
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    scaleMode

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    scaleMode + + +number + + + +

    The current scaleMode.

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

    <readonly> sourceAspectRatio

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    sourceAspectRatio + + +number + + + +

    The aspect ratio (width / height) of the original game dimensions.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -3718,7 +4012,7 @@ It doesn't care about any other DOM element that may be on the page, it literall
    Source:
    @@ -3787,7 +4081,7 @@ It doesn't care about any other DOM element that may be on the page, it literall
    Source:
    @@ -3905,7 +4199,7 @@ It doesn't care about any other DOM element that may be on the page, it literall
    Source:
    @@ -4118,7 +4412,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
    Source:
    @@ -4236,7 +4530,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
    Source:
    @@ -4305,7 +4599,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
    Source:
    @@ -4374,7 +4668,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
    Source:
    @@ -4443,7 +4737,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
    Source:
    @@ -4561,7 +4855,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
    Source:
    @@ -4630,7 +4924,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
    Source:
    @@ -4699,7 +4993,7 @@ The optional orientationImage is displayed when the game is in the incorrect ori
    Source:
    @@ -4818,7 +5112,7 @@ Please note that this needs to be supported by the web browser and isn't the sam
    Source:
    @@ -4887,7 +5181,7 @@ Please note that this needs to be supported by the web browser and isn't the sam
    Source:
    @@ -4938,7 +5232,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 Sat Feb 08 2014 07:19:51 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:26 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.State.html b/docs/Phaser.State.html index a7006252..25c55d2f 100644 --- a/docs/Phaser.State.html +++ b/docs/Phaser.State.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -2602,7 +2610,7 @@ If you need to use the loader, you may need to use them here.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:51 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:26 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.StateManager.html b/docs/Phaser.StateManager.html index 6c14776a..537d5374 100644 --- a/docs/Phaser.StateManager.html +++ b/docs/Phaser.StateManager.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -2162,7 +2170,7 @@
    -

    Checks i a given phaser state is valid. +

    Checks if a given phaser state is valid. State must exist and have at least one callback function registered..

    @@ -2245,7 +2253,7 @@ State must exist and have at least one callback function registered..

    Source:
    @@ -2337,7 +2345,7 @@ State must exist and have at least one callback function registered..

    Source:
    @@ -2406,7 +2414,7 @@ State must exist and have at least one callback function registered..

    Source:
    @@ -2535,7 +2543,7 @@ State must exist and have at least one callback function registered..

    Source:
    @@ -2600,7 +2608,7 @@ State must exist and have at least one callback function registered..

    Source:
    @@ -2665,7 +2673,7 @@ State must exist and have at least one callback function registered..

    Source:
    @@ -2730,7 +2738,7 @@ State must exist and have at least one callback function registered..

    Source:
    @@ -2913,7 +2921,7 @@ State must exist and have at least one callback function registered..

    Source:
    @@ -2978,7 +2986,7 @@ State must exist and have at least one callback function registered..

    Source:
    @@ -3014,7 +3022,7 @@ State must exist and have at least one callback function registered..

    -

    Start the given state

    +

    Start the given State. If a State is already running then State.shutDown will be called (if it exists) before switching to the new State.

    @@ -3040,6 +3048,8 @@ State must exist and have at least one callback function registered..

    + Default + Description @@ -3073,6 +3083,10 @@ State must exist and have at least one callback function registered..

    + + + +

    The key of the state you want to start.

    @@ -3106,8 +3120,14 @@ State must exist and have at least one callback function registered..

    + + + true + + + -

    clear everything in the world? (Default to true)

    +

    Clear everything in the world? This clears the World display list fully (but not the Stage, so if you've added your own objects to the Stage they will need managing directly)

    @@ -3139,8 +3159,14 @@ State must exist and have at least one callback function registered..

    + + + false + + + -

    clear asset cache? (Default to false and ONLY available when clearWorld=true)

    +

    Clear the Game.Cache? This purges out all loaded assets. The default is false and you must have clearWorld=true if you want to clearCache as well.

    @@ -3237,7 +3263,7 @@ State must exist and have at least one callback function registered..

    Source:
    @@ -3288,7 +3314,7 @@ State must exist and have at least one callback function registered..

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:51 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:26 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Text.html b/docs/Phaser.Text.html index 6b00f9c5..ec3fbfda 100644 --- a/docs/Phaser.Text.html +++ b/docs/Phaser.Text.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -692,7 +700,7 @@
    -

    alive

    +

    align

    @@ -731,13 +739,13 @@ - alive + align -boolean +string @@ -747,119 +755,7 @@ -

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

    - - - - - -
    - - - - - - - - - - - - - - - - - - -
    Default Value:
    -
    • true
    - - - -
    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:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -888,7 +784,7 @@ Setting the anchor to 1,1 would mean the textures origin points will be the bott
    Source:
    @@ -996,7 +892,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    @@ -1069,7 +965,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati - + @@ -1098,7 +994,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    @@ -1116,16 +1012,12 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

    content

    +

    events

    -
    -

    The string to be rendered by this Text object.

    -
    - @@ -1159,13 +1051,13 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    - + + @@ -1204,7 +1096,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    @@ -1318,6 +1210,108 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati + + + + + + + + +
    +

    fill

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + +
    NameTypeDescription
    anchor - - -Phaser.Point - - - -

    The anchor around which rotation and scaling takes place.

    Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text.

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

    If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.

    contentevents -string +Phaser.Events @@ -1175,7 +1067,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -

    The string to be rendered by this Text object.

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

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    fill + + +object + + + +

    A canvas fillstyle that will be used on the text eg 'red', '#00FF00'.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + +
    @@ -1334,7 +1328,9 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

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

    +

    An Text that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Text.cameraOffset. +Note that the cameraOffset values are in addition to any parent in the display list. +So if this Text was in a Group that has x: 200, then this will be added to the cameraOffset.x

    @@ -1386,7 +1382,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -

    Fixes this object to the Camera.

    +

    Set to true to fix this Text to the Camera at its current world coordinates.

    @@ -1411,14 +1407,11 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -
    Default Value:
    -
    • false
    -
    Source:
    @@ -1442,10 +1435,6 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -
    -

    The font the text will be rendered in.

    -
    - @@ -1495,7 +1484,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -

    The font the text will be rendered in.

    +

    The font the text will be rendered in, i.e. 'Arial'. Must be loaded in the browser before use.

    @@ -1524,7 +1513,211 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    fontSize

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    fontSize + + +number + + + +

    The size of the font in pixels.

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

    fontWeight

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    fontWeight + + +number + + + +

    The weight of the font: 'normal', 'bold', 'italic'. You can combine settings too, such as 'bold italic'.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1644,7 +1837,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

    group

    +

    input

    @@ -1683,13 +1876,16 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati - group + input -Phaser.Group +Phaser.InputHandler +| + +null @@ -1699,7 +1895,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -

    The parent Group of this Text object.

    +

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

    @@ -1728,7 +1924,216 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    inputEnabled

    + + +
    +
    + +
    +

    By default a Text object 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:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    lineSpacing

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    lineSpacing + + +number + + + +

    Additional spacing (in pixels) between each line of text if multi-line.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -1830,7 +2235,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    @@ -1848,7 +2253,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

    renderable

    +

    shadowBlur

    @@ -1887,13 +2292,13 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati - renderable + shadowBlur -boolean +number @@ -1903,7 +2308,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -

    A renderable object will be rendered to the context each frame.

    +

    The shadowBlur value. Make the shadow softer by applying a Gaussian blur to it. A number from 0 (no blur) up to approx. 10 (depending on scene).

    @@ -1932,7 +2337,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    @@ -1950,7 +2355,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

    scale

    +

    shadowColor

    @@ -1989,13 +2394,13 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati - scale + shadowColor -Phaser.Point +string @@ -2005,7 +2410,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -

    The scale of the object 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 color of the shadow, as given in CSS rgba format. Set the alpha component to 0 to disable the shadow.

    @@ -2034,7 +2439,521 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    shadowOffsetX

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    shadowOffsetX + + +number + + + +

    The shadowOffsetX value in pixels. This is how far offset horizontally the shadow effect will be.

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

    shadowOffsetY

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    shadowOffsetY + + +number + + + +

    The shadowOffsetY value in pixels. This is how far offset vertically the shadow effect will be.

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

    stroke

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    stroke + + +string + + + +

    A canvas fillstyle that will be used on the text stroke eg 'blue', '#FCFF00'.

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

    strokeThickness

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    strokeThickness + + +number + + + +

    A number that represents the thickness of the stroke. Default is 0 (no stroke)

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

    text

    + + +
    +
    + +
    +

    The text string to be displayed by this Text object, taking into account the style settings.

    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    text + + +string + + + +

    The text string to be displayed by this Text object, taking into account the style settings.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -2136,7 +3055,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    @@ -2154,16 +3073,12 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

    x

    +

    wordWrap

    -
    -

    The x coordinate of this object in world space.

    -
    - @@ -2197,13 +3112,13 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati - x + wordWrap -number +boolean @@ -2213,7 +3128,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -

    The x coordinate of this object in world space.

    +

    Indicates if word wrap should be used.

    @@ -2242,7 +3157,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    @@ -2260,16 +3175,12 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

    y

    +

    wordWrapWidth

    -
    -

    The y coordinate of this object in world space.

    -
    - @@ -2303,7 +3214,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati - y + wordWrapWidth @@ -2319,7 +3230,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -

    The y coordinate of this object in world space.

    +

    The width at which text will wrap.

    @@ -2348,7 +3259,109 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    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:
    +
    @@ -2409,7 +3422,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    @@ -2437,13 +3450,17 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

    destroy()

    +

    postUpdate()

    +
    +

    Automatically called by World.postUpdate.

    +
    + @@ -2474,7 +3491,760 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    preUpdate()

    + + +
    +
    + + +
    +

    Automatically called by World.preUpdate.

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

    setShadow(x, y, color, blur)

    + + +
    +
    + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    x + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    The shadowOffsetX value in pixels. This is how far offset horizontally the shadow effect will be.

    y + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    The shadowOffsetY value in pixels. This is how far offset vertically the shadow effect will be.

    color + + +string + + + + + + <optional>
    + + + + + +
    + + 'rgba(0,0,0,0)' + +

    The color of the shadow, as given in CSS rgba format. Set the alpha component to 0 to disable the shadow.

    blur + + +number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    The shadowBlur value. Make the shadow softer by applying a Gaussian blur to it. A number from 0 (no blur) up to approx. 10 (depending on scene).

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

    setStyle(style)

    + + +
    +
    + + +
    +

    Set the style of the text by passing a single style object to it.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    style + + +Object + + + + + + <optional>
    + + + + + +

    The style parameters

    +
    Properties
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    font + + +String + + + + + + <optional>
    + + + + + +
    + + 'bold 20pt Arial' + +

    The style and size of the font

    fill + + +Object + + + + + + <optional>
    + + + + + +
    + + 'black' + +

    A canvas fillstyle that will be used on the text eg 'red', '#00FF00'

    align + + +String + + + + + + <optional>
    + + + + + +
    + + 'left' + +

    Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text

    stroke + + +String + + + + + + <optional>
    + + + + + +
    + + 'black' + +

    A canvas fillstyle that will be used on the text stroke eg 'blue', '#FCFF00'

    strokeThickness + + +Number + + + + + + <optional>
    + + + + + +
    + + 0 + +

    A number that represents the thickness of the stroke. Default is 0 (no stroke)

    wordWrap + + +Boolean + + + + + + <optional>
    + + + + + +
    + + false + +

    Indicates if word wrap should be used

    wordWrapWidth + + +Number + + + + + + <optional>
    + + + + + +
    + + 100 + +

    The width at which text will wrap

    + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -2510,7 +4280,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    -

    Automatically called by World.update.

    +

    Override and use this function in your own custom objects to handle any update requirements you may have.

    @@ -2543,7 +4313,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    @@ -2594,7 +4364,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 Sat Feb 08 2014 07:19:51 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:27 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Tile.html b/docs/Phaser.Tile.html index 1ae5a9a1..7aef9abb 100644 --- a/docs/Phaser.Tile.html +++ b/docs/Phaser.Tile.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -910,213 +918,6 @@ -
    - - - -
    - - - -
    -

    callback

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    callback - - -function - - - -

    Tile collision callback.

    -
    - - - - - - - - - - - - - - - - - - -
    Default Value:
    -
    • null
    - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    callbackContext

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    callbackContext - - -object - - - -

    The context in which the collision callback will be called.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - -
    @@ -1846,6 +1647,213 @@ + + + + +
    + + + +
    +

    collisionCallback

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    collisionCallback + + +function + + + +

    Tile collision callback.

    +
    + + + + + + + + + + + + + + + + + + +
    Default Value:
    +
    • null
    + + + +
    Source:
    +
    + + + + + + + +
    + + + +
    + + + +
    +

    collisionCallbackContext

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    collisionCallbackContext + + +object + + + +

    The context in which the collision callback will be called.

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + +
    @@ -3916,7 +3924,7 @@ The callback must true true for collision processing to take place.

    -

    Callback will be called with this context.

    +

    Callback will be called within this context.

    @@ -3999,7 +4007,7 @@ The callback must true true for collision processing to take place.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:51 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:27 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.TileSprite.html b/docs/Phaser.TileSprite.html index 29baf294..741c537e 100644 --- a/docs/Phaser.TileSprite.html +++ b/docs/Phaser.TileSprite.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -455,7 +463,7 @@ TileSprite -

    Phaser.Tilemap

    +

    Phaser.TileSprite

    @@ -466,7 +474,7 @@
    -

    new TileSprite(game, x, y, width, height, key)

    +

    new TileSprite(game, x, y, width, height, key, frame)

    @@ -474,7 +482,8 @@
    -

    A TileSprite is a Sprite whos texture is set to repeat and can be scrolled. As it scrolls the texture repeats (wraps) on the edges.

    +

    A TileSprite is a Sprite that has a repeating texture. The texture can be scrolled and scaled and will automatically wrap on the edges as it does so. +Please note that TileSprites have no input handler or physics bodies.

    @@ -524,7 +533,7 @@ -

    Current game instance.

    +

    A reference to the currently running game.

    @@ -547,7 +556,7 @@ -

    X position of the new tileSprite.

    +

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

    @@ -570,7 +579,7 @@ -

    Y position of the new tileSprite.

    +

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

    @@ -593,7 +602,7 @@ -

    the width of the tilesprite.

    +

    The width of the TileSprite.

    @@ -616,7 +625,7 @@ -

    the height of the tilesprite.

    +

    The height of the TileSprite.

    @@ -635,6 +644,9 @@ Phaser.RenderTexture | +Phaser.BitmapData +| + PIXI.Texture @@ -645,7 +657,33 @@ -

    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.

    +

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

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

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

    @@ -677,7 +715,7 @@
    Source:
    @@ -706,12 +744,6 @@ -

    Extends

    - - - @@ -726,116 +758,6 @@
    -
    -

    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.

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

    angle

    @@ -846,7 +768,7 @@

    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.

    +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.

    @@ -898,7 +820,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -

    Gets or sets the Sprites angle of rotation in degrees.

    +

    The angle of this Sprite in degrees.

    @@ -927,7 +849,7 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati
    Source:
    @@ -1015,11 +937,6 @@ If you wish to work in radians instead of degrees use the property Sprite.rotati -
    Inherited From:
    -
    - @@ -1034,886 +951,7 @@ 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:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    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.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - -
    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.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - -
    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.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    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:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    bottomLeft

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    bottomLeft - - -Phaser.Point - - - -

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

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    bottomRight

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    bottomRight - - -Phaser.Point - - - -

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

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    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 - - - -
    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    @@ -1986,7 +1024,7 @@ It's used for Camera culling and physics body alignment.

    -

    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.

    +

    If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.

    @@ -2001,11 +1039,6 @@ It's used for Camera culling and physics body alignment.

    -
    Inherited From:
    -
    - @@ -2020,996 +1053,7 @@ It's used for Camera culling and physics body alignment.

    Source:
    - - - - - - - -
    - - - -
    - - - -
    -

    center

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    center - - -Phaser.Point - - - -

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

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    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.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    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.

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

    currentFrame

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    currentFrame - - -Phaser.Frame - - - -

    A reference to the currently displayed frame.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    debug

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    debug - - -boolean - - - -

    Handy flag to use with Game.enableStep

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

    debug

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    debug - - -boolean - - - -

    Handy flag to use with Game.enableStep

    -
    - - - - - - - - -
    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:
    -
    @@ -3097,11 +1141,6 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -
    Inherited From:
    -
    - @@ -3116,334 +1155,7 @@ 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:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    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:
    -
    @@ -3468,7 +1180,9 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -

    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.

    +

    An TileSprite that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in TileSprite.cameraOffset. +Note that the cameraOffset values are in addition to any parent in the display list. +So if this TileSprite was in a Group that has x: 200, then this will be added to the cameraOffset.x

    @@ -3520,7 +1234,7 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -

    Fixes this Sprite to the Camera.

    +

    Set to true to fix this TileSprite to the Camera at its current world coordinates.

    @@ -3535,11 +1249,6 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -
    Inherited From:
    -
    - @@ -3550,129 +1259,11 @@ The crop is only applied if you have set Sprite.cropEnabled to true.

    -
    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.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - -
    Default Value:
    -
    • false
    -
    Source:
    @@ -3774,7 +1365,7 @@ Note that if this Image is a child of a display object that has changed its posi
    Source:
    @@ -3876,7 +1467,7 @@ Note that if this Image is a child of a display object that has changed its posi
    Source:
    @@ -3964,11 +1555,6 @@ Note that if this Image is a child of a display object that has changed its posi -
    Inherited From:
    -
    - @@ -3983,1194 +1569,7 @@ Note that if this Image is a child of a display object that has changed its posi
    Source:
    - - - - - - - -
    - - - -
    - - - -
    -

    game

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    game - - -Phaser.Game - - - -

    A reference to the currently running Game.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    health

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    health - - -number - - - -

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

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    health

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    health - - -number - - - -

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

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    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.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    <readonly> inCamera

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    inCamera - - -boolean - - - -

    Is this sprite visible to the camera or not?

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    input

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    input - - -Phaser.InputHandler - - - -

    The Input Handler Component.

    -
    - - - - - - - - -
    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 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:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    inWorld

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    inWorld - - -boolean - - - -

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

    -
    - - - - - - - - -
    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:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    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.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - -
    Default Value:
    -
    • 0
    - - - -
    Source:
    -
    @@ -5267,11 +1666,6 @@ activated for this Sprite instance and it will then start to process click/touch -
    Inherited From:
    -
    - @@ -5286,353 +1680,7 @@ 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:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    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:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    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:
    -
    @@ -5720,11 +1768,6 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze -
    Inherited From:
    -
    - @@ -5739,1286 +1782,7 @@ 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:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    offset

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    offset - - -Phaser.Point - - - -

    Corner point defaults. Should not typically be modified.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    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:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    outOfBoundsKill

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    outOfBoundsKill - - -boolean - - - -

    If true the Sprite is killed as soon as Sprite.inWorld is false.

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

    renderOrderID

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    renderOrderID - - -number - - - -

    Used by the Renderer and Input Manager to control picking order.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    <readonly> renderOrderID

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    renderOrderID - - -number - - - -

    The render order ID, reset every frame.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    texture

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    texture - - -PIXI.Texture - - - -

    The texture that the sprite renders with.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    textureRegion

    - - -
    -
    - -
    -

    The rectangular area from the texture that will be rendered.

    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    textureRegion - - -Phaser.Rectangle - - - -
    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    tilePosition

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    tilePosition - - -Phaser.Point - - - -

    The offset position of the image that is being tiled.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    tileScale

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    tileScale - - -Phaser.Point - - - -

    The scaling of the image that is being tiled.

    -
    - - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    topLeft

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    topLeft - - -Phaser.Point - - - -

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

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    topRight

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    topRight - - -Phaser.Point - - - -

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

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    @@ -7120,119 +1884,7 @@ The lifespan is decremented by game.time.elapsed each update, once it reaches ze
    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.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    @@ -7320,11 +1972,6 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    -
    Inherited From:
    -
    - @@ -7339,542 +1986,7 @@ 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:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    <readonly> worldCenterX

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    worldCenterX - - -number - - - -

    The center of the Sprite in world coordinates.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    <readonly> worldCenterY

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    worldCenterY - - -number - - - -

    The center of the Sprite in world coordinates.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    x

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    x - - -number - - - -

    The x coordinate in world space of this Sprite.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - -
    - - - -
    -

    y

    - - -
    -
    - - - - - -
    - - -
    Properties:
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDescription
    y - - -number - - - -

    The y coordinate in world space of this Sprite.

    -
    - - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    @@ -7898,7 +2010,7 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    -

    bringToTop()

    +

    autoScroll()

    @@ -7906,8 +2018,10 @@ If you wish to crop the Sprite instead see the Sprite.crop value.

    -

    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.

    +

    Sets this TileSprite to automatically scroll in the given direction until stopped via TileSprite.stopScroll(). +The scroll speed is specified in pixels per second. +A negative x value will scroll to the left. A positive x value will scroll to the right. +A negative y value will scroll up. A positive y value will scroll down.

    @@ -7926,11 +2040,6 @@ bought to the top of that Group, not the entire display list.

    -
    Inherited From:
    -
    - @@ -7945,924 +2054,7 @@ 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:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    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.

    - - - - -
    - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    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:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    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.

    - - - - -
    - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    (Phaser.Sprite) This instance.

    -
    - - - - - - - -
    - - - -
    -

    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 - - -
    -
    - - - - - -
    - - - -
    -

    destroy()

    - - -
    -
    - - -
    -

    Destroy this Graphics instance.

    -
    - - - - - - - - - -
    - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    @@ -8898,7 +2090,7 @@ If health is then taken below zero Sprite.kill is called.

    -

    Destroys the Sprite. This removes it from its parent group, destroys the input, event and animation handlers if present +

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

    @@ -8918,11 +2110,6 @@ and nulls its reference to game, freeing it up for garbage collection.

    -
    Inherited From:
    -
    - @@ -8937,7 +2124,7 @@ and nulls its reference to game, freeing it up for garbage collection.

    Source:
    @@ -8960,718 +2147,6 @@ and nulls its reference to game, freeing it up for garbage collection.

    -
    - - - -
    -

    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:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    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.

    - - - - -
    - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    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.

    - - - - -
    - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    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.

    -
    - - - - - - - - - -
    - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    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:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    (Phaser.Sprite) This instance.

    -
    - - - - - - -
    @@ -9685,7 +2160,7 @@ If you don't need this Sprite any more you should call Sprite.destroy instead. -

    Changes the Texture the Sprite is using entirely. The old texture is removed and the new one is referenced or fetched from the Cache. +

    Changes the Texture the TileSprite 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.

    @@ -9789,11 +2264,6 @@ This causes a WebGL texture update, so use sparingly or in low-intensity portion -
    Inherited From:
    -
    - @@ -9808,166 +2278,7 @@ 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:
    -
    @@ -10205,11 +2516,6 @@ If the requested animation is already playing this request will be ignored. If y -
    Inherited From:
    -
    - @@ -10224,287 +2530,7 @@ 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:
    -
    @@ -10582,11 +2608,6 @@ If the requested animation is already playing this request will be ignored. If y -
    Inherited From:
    -
    - @@ -10601,155 +2622,7 @@ 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:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    preUpdate()

    - - -
    -
    - - -
    -

    Automatically called by World.preUpdate. Handles cache updates, lifespan checks, animation updates and physics updates.

    -
    - - - - - - - - - -
    - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    @@ -10804,11 +2677,6 @@ If the requested animation is already playing this request will be ignored. If y -
    Inherited From:
    -
    - @@ -10823,7 +2691,7 @@ If the requested animation is already playing this request will be ignored. If y
    Source:
    @@ -10851,7 +2719,7 @@ If the requested animation is already playing this request will be ignored. If y
    -

    reset(x, y, health)

    +

    stopScroll()

    @@ -10859,459 +2727,7 @@ If the requested animation is already playing this request will be ignored. If y
    -

    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:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    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:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    (Phaser.Sprite) This instance.

    -
    - - - - - - - -
    - - - -
    -

    resetCrop()

    - - -
    -
    - - -
    -

    Resets the Sprite.crop value back to the frame dimensions.

    +

    Stops an automatically scrolling TileSprite.

    @@ -11330,11 +2746,6 @@ If the Sprite has a physics body that too is reset.

    -
    Inherited From:
    -
    - @@ -11349,7 +2760,7 @@ If the Sprite has a physics body that too is reset.

    Source:
    @@ -11377,7 +2788,7 @@ If the Sprite has a physics body that too is reset.

    -

    revive(health)

    +

    update()

    @@ -11385,319 +2796,7 @@ If the Sprite has a physics body that too is reset.

    -

    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:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    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:
    -
    - - - - - - - -
    - - - - - - - - - - - -
    Returns:
    - - -
    -

    (Phaser.Sprite) This instance.

    -
    - - - - - - - -
    - - - -
    -

    updateAnimation()

    - - -
    -
    - - -
    -

    Internal function called by preUpdate.

    +

    Override and use this function in your own custom objects to handle any update requirements you may have.

    @@ -11716,11 +2815,6 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived -
    Inherited From:
    -
    - @@ -11735,229 +2829,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived
    Source:
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    updateBounds()

    - - -
    -
    - - -
    -

    Internal function called by preUpdate.

    -
    - - - - - - - - - -
    - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    updateCache()

    - - -
    -
    - - -
    -

    Internal function called by preUpdate.

    -
    - - - - - - - - - -
    - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    updateCrop()

    - - -
    -
    - - -
    -

    Internal function called by preUpdate.

    -
    - - - - - - - - - -
    - - - - - - - -
    Inherited From:
    -
    - - - - - - - - - - - - - -
    Source:
    -
    @@ -12008,7 +2880,7 @@ It will dispatch the onRevived event, you can listen to Sprite.events.onRevived Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:52 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:27 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Tilemap.html b/docs/Phaser.Tilemap.html index 789fd2db..859df6f4 100644 --- a/docs/Phaser.Tilemap.html +++ b/docs/Phaser.Tilemap.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -686,7 +694,7 @@ A map may have multiple layers. You can perform operations on the map data such
    Source:
    @@ -746,7 +754,109 @@ A map may have multiple layers. You can perform operations on the map data such
    Source:
    + + + + + + + +
    + + + +
    + + + +
    +

    collision

    + + +
    +
    + + + + + +
    + + +
    Properties:
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    collision + + +array + + + +

    An array of collision data (polylines, etc).

    +
    + + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -848,7 +958,7 @@ A map may have multiple layers. You can perform operations on the map data such
    Source:
    @@ -950,7 +1060,7 @@ A map may have multiple layers. You can perform operations on the map data such
    Source:
    @@ -1358,7 +1468,7 @@ A map may have multiple layers. You can perform operations on the map data such
    Source:
    @@ -2740,7 +2850,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -2858,7 +2968,143 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    clearPhysicsBodies(layer)

    + + +
    +
    + + +
    +

    Clears all physics bodies from the world for the given layer.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDescription
    layer + + +number +| + +string +| + +Phaser.TilemapLayer + + + + + + <optional>
    + + + + + +

    The layer to operate on. If not given will default to this.currentLayer.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -3118,7 +3364,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -3305,7 +3551,7 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or
    Source:
    @@ -3328,6 +3574,205 @@ Note that the tileset name can be found in the JSON file exported from Tiled, or +
    + + + +
    +

    createCollisionObjects(layer, addToWorld) → {array}

    + + +
    +
    + + +
    +

    Converts all of the polylines inside a Tiled ObjectGroup into physics bodies that are added to the world. +Note that the polylines must be created in such a way that they can withstand polygon decomposition.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    layer + + +string + + + + + + <optional>
    + + + + + +
    + +

    The Tiled layer to operate on that contains the collision data.

    addToWorld + + +boolean + + + + + + <optional>
    + + + + + +
    + + true + +

    If true it will automatically add each body to the world.

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

    An array of the Phaser.Physics.Body objects that have been created.

    +
    + + + +
    +
    + Type +
    +
    + +array + + +
    +
    + + + + +
    @@ -3667,7 +4112,7 @@ Sprite is created. You could also give it a value like: body.velocity.x: 100 to
    Source:
    @@ -3899,7 +4344,7 @@ Or you can open the JSON file it exports and look at the layers[].name value. Ei
    Source:
    @@ -3991,7 +4436,7 @@ Or you can open the JSON file it exports and look at the layers[].name value. Ei
    Source:
    @@ -4060,7 +4505,7 @@ Or you can open the JSON file it exports and look at the layers[].name value. Ei
    Source:
    @@ -4351,7 +4796,7 @@ Or you can open the JSON file it exports and look at the layers[].name value. Ei
    Source:
    @@ -4673,7 +5118,7 @@ Or you can open the JSON file it exports and look at the layers[].name value. Ei
    Source:
    @@ -4696,6 +5141,213 @@ Or you can open the JSON file it exports and look at the layers[].name value. Ei + + + + +
    +

    generateCollisionData(layer, addToWorld) → {array}

    + + +
    +
    + + +
    +

    Goes through all tiles in the given layer and converts those set to collide into physics bodies in the world. +Only call this after you have specified all of the tiles you wish to collide with calls like Tilemap.setCollisionBetween, etc. +Every time you call this method it will destroy any previously created bodies and remove them from the world. +Therefore understand it's an expensive operation and not to be done in a core game update loop.

    +
    + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeArgumentDefaultDescription
    layer + + +number +| + +string +| + +Phaser.TilemapLayer + + + + + + <optional>
    + + + + + +
    + +

    The layer to operate on. If not given will default to this.currentLayer.

    addToWorld + + +boolean + + + + + + <optional>
    + + + + + +
    + + true + +

    If true it will automatically add each body to the world, otherwise it's up to you to do so.

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

    An array of the Phaser.Physics.Body objects that have been created.

    +
    + + + +
    +
    + Type +
    +
    + +array + + +
    +
    + + + + +
    @@ -4791,7 +5443,7 @@ Or you can open the JSON file it exports and look at the layers[].name value. Ei
    Source:
    @@ -4955,7 +5607,7 @@ Or you can open the JSON file it exports and look at the layers[].name value. Ei
    Source:
    @@ -5102,7 +5754,7 @@ Or you can open the JSON file it exports and look at the layers[].name value. Ei
    Source:
    @@ -5243,7 +5895,7 @@ Or you can open the JSON file it exports and look at the layers[].name value. Ei
    Source:
    @@ -5384,7 +6036,7 @@ Or you can open the JSON file it exports and look at the layers[].name value. Ei
    Source:
    @@ -5605,7 +6257,7 @@ Or you can open the JSON file it exports and look at the layers[].name value. Ei
    Source:
    @@ -5793,7 +6445,7 @@ Mostly used as an internal function by calculateFaces.

    Source:
    @@ -5958,7 +6610,7 @@ Mostly used as an internal function by calculateFaces.

    Source:
    @@ -6123,7 +6775,7 @@ Mostly used as an internal function by calculateFaces.

    Source:
    @@ -6288,7 +6940,7 @@ Mostly used as an internal function by calculateFaces.

    Source:
    @@ -6406,7 +7058,7 @@ Mostly used as an internal function by calculateFaces.

    Source:
    @@ -6627,7 +7279,7 @@ Mostly used as an internal function by calculateFaces.

    Source:
    @@ -6879,7 +7531,7 @@ Mostly used as an internal function by calculateFaces.

    Source:
    @@ -7111,7 +7763,7 @@ Mostly used as an internal function by calculateFaces.

    Source:
    @@ -7405,7 +8057,7 @@ Mostly used as an internal function by calculateFaces.

    Source:
    @@ -7665,7 +8317,7 @@ Mostly used as an internal function by calculateFaces.

    Source:
    @@ -7734,7 +8386,7 @@ Mostly used as an internal function by calculateFaces.

    Source:
    @@ -8056,7 +8708,7 @@ Mostly used as an internal function by calculateFaces.

    Source:
    @@ -8276,7 +8928,7 @@ The collides parameter controls if collision will be enabled (true)
    Source:
    @@ -8529,7 +9181,7 @@ The collides parameter controls if collision will be enabled (true)
    Source:
    @@ -8746,7 +9398,7 @@ The collides parameter controls if collision will be enabled (true)
    Source:
    @@ -8996,7 +9648,7 @@ You shouldn't usually call this method directly, instead use setCollision, setCo
    Source:
    @@ -9120,7 +9772,7 @@ You shouldn't usually call this method directly, instead use setCollision, setCo
    Source:
    @@ -9354,7 +10006,7 @@ If you want to set a callback for a tile at a specific location on the map then
    Source:
    @@ -9678,7 +10330,7 @@ If you want to set a callback for a tile at a specific location on the map then
    Source:
    @@ -9938,7 +10590,7 @@ If you want to set a callback for a tile at a specific location on the map then
    Source:
    @@ -10260,7 +10912,7 @@ If you want to set a callback for a tile at a specific location on the map then
    Source:
    @@ -10311,7 +10963,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 Sat Feb 08 2014 07:19:51 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:27 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.TilemapLayer.html b/docs/Phaser.TilemapLayer.html index fd9324a7..6d1cef17 100644 --- a/docs/Phaser.TilemapLayer.html +++ b/docs/Phaser.TilemapLayer.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -4634,7 +4642,7 @@ half as quickly as the 'normal' camera-locked layers do)

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:52 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:27 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.TilemapParser.html b/docs/Phaser.TilemapParser.html index 00666bcf..e094c566 100644 --- a/docs/Phaser.TilemapParser.html +++ b/docs/Phaser.TilemapParser.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -550,6 +558,98 @@
    +
    +

    <static> getEmptyData() → {object}

    + + +
    +
    + + +
    +

    Returns an empty map data object.

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

    Generated map data.

    +
    + + + +
    +
    + Type +
    +
    + +object + + +
    +
    + + + + + +
    + + +

    <static> parse(game, key) → {object}

    @@ -946,7 +1046,7 @@
    Source:
    @@ -1477,7 +1577,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:52 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:27 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Tileset.html b/docs/Phaser.Tileset.html index f33eb683..6e15da2c 100644 --- a/docs/Phaser.Tileset.html +++ b/docs/Phaser.Tileset.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -2636,7 +2644,7 @@ You should not normally instantiate this class directly.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:52 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:27 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Time.html b/docs/Phaser.Time.html index 4206af8f..0deda5cc 100644 --- a/docs/Phaser.Time.html +++ b/docs/Phaser.Time.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -3116,7 +3124,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:52 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:27 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Timer.html b/docs/Phaser.Timer.html index 62f289d1..a51dd3a9 100644 --- a/docs/Phaser.Timer.html +++ b/docs/Phaser.Timer.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -3780,7 +3788,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 Sat Feb 08 2014 07:19:52 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:28 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.TimerEvent.html b/docs/Phaser.TimerEvent.html index 6cffa887..1ffcf3c2 100644 --- a/docs/Phaser.TimerEvent.html +++ b/docs/Phaser.TimerEvent.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1705,7 +1713,7 @@ It can call a specific callback, passing in optional parameters.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:52 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:28 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Touch.html b/docs/Phaser.Touch.html index db008289..f80c41b4 100644 --- a/docs/Phaser.Touch.html +++ b/docs/Phaser.Touch.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -2675,7 +2683,7 @@ Doesn't appear to be supported by most browsers on a canvas element yet.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:53 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:28 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Tween.html b/docs/Phaser.Tween.html index c4c94645..8a498ebd 100644 --- a/docs/Phaser.Tween.html +++ b/docs/Phaser.Tween.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -3164,7 +3172,7 @@ Used in combination with repeat you can create endless loops.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:53 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:28 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.TweenManager.html b/docs/Phaser.TweenManager.html index 8ef46d6d..284733b5 100644 --- a/docs/Phaser.TweenManager.html +++ b/docs/Phaser.TweenManager.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1668,7 +1676,7 @@ Please see https://github.com/sole/tw Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:53 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:28 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Utils.Debug.html b/docs/Phaser.Utils.Debug.html index 72d1b6ee..ad2bb19d 100644 --- a/docs/Phaser.Utils.Debug.html +++ b/docs/Phaser.Utils.Debug.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1946,7 +1954,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -2189,7 +2197,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -2350,7 +2358,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -2558,7 +2566,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -2731,7 +2739,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -2974,7 +2982,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -3050,7 +3058,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL -array +Phaser.Body @@ -3072,7 +3080,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL - +

    The Phaser.Body instance to render all shapes from.

    @@ -3143,7 +3151,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -3335,7 +3343,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -3496,7 +3504,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -3786,7 +3794,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -4029,176 +4037,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    - - - - - - - -
    - - - - - - - - - - - - - - - - - -
    -

    renderPolygon(polygon, color)

    - - -
    -
    - - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDefaultDescription
    polygon - - -array - - - - - - - - - - - -
    color - - -string - - - - - - <optional>
    - - - - - -
    - - 'rgb(255,255,255)' - -

    The color the polygon is stroked in.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -4549,7 +4388,579 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    + + + + + + + +
    + + + + + + + + + + + + + +
    + + + +
    +

    renderShape(shape, x, y, angle)

    + + +
    +
    + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    shape + + +p2.Shape + + + +

    The shape to render.

    x + + +number + + + +

    The x coordinate of the Body to translate to.

    y + + +number + + + +

    The y coordinate of the Body to translate to.

    angle + + +number + + + +

    The angle of the Body to rotate to.

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

    renderShape(x, y, shape, offset, angle)

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

    The x coordinate of the Body to translate to.

    y + + +number + + + +

    The y coordinate of the Body to translate to.

    shape + + +p2.Shape + + + +

    The shape to render.

    offset + + +number + + + +

    -

    angle + + +number + + + +

    -

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

    renderShape(shape, x, y, angle)

    + + +
    +
    + + + + + + + + +
    Parameters:
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDescription
    shape + + +p2.Shape + + + +

    The shape to render.

    x + + +number + + + +

    The x coordinate of the Body to translate to.

    y + + +number + + + +

    The y coordinate of the Body to translate to.

    angle + + +number + + + +

    The angle of the Body to rotate to.

    + + + + +
    + + + + + + + + + + + + + + + + + + + +
    Source:
    +
    @@ -4792,427 +5203,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    renderSpriteBounds(sprite, color, fill)

    - - -
    -
    - - -
    -

    Renders just the full Sprite bounds.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDefaultDescription
    sprite - - -Phaser.Sprite - - - - - - - - - - - -

    Description.

    color - - -string - - - - - - <optional>
    - - - - - -
    - -

    Color of the debug info to be rendered (format is css color string).

    fill - - -boolean - - - - - - <optional>
    - - - - - -
    - - false - -

    If false the bounds outline is rendered, if true the whole rectangle is rendered.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    renderSpriteBounds(sprite, color, fill)

    - - -
    -
    - - -
    -

    Renders just the full Sprite bounds.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDefaultDescription
    sprite - - -Phaser.Sprite - - - - - - - - - - - -

    Description.

    color - - -string - - - - - - <optional>
    - - - - - -
    - -

    Color of the debug info to be rendered (format is css color string).

    fill - - -boolean - - - - - - <optional>
    - - - - - -
    - - false - -

    If false the bounds outline is rendered, if true the whole rectangle is rendered.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -5455,258 +5446,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    - - - - - - - -
    - - - - - - - - - - - - - -
    - - - -
    -

    renderSpriteCorners(sprite, showText, showBounds, color)

    - - -
    -
    - - -
    -

    Renders the corners and point information of the given Sprite.

    -
    - - - - - - - -
    Parameters:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeArgumentDefaultDescription
    sprite - - -Phaser.Sprite - - - - - - - - - - - -

    The sprite to be rendered.

    showText - - -boolean - - - - - - <optional>
    - - - - - -
    - - false - -

    If true the x/y coordinates of each point will be rendered.

    showBounds - - -boolean - - - - - - <optional>
    - - - - - -
    - - false - -

    If true the bounds will be rendered over the top of the sprite.

    color - - -string - - - - - - <optional>
    - - - - - -
    - - 'rgb(255,0,255)' - -

    The color the text is rendered in.

    - - - - -
    - - - - - - - - - - - - - - - - - - - -
    Source:
    -
    @@ -5949,7 +5689,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -6192,7 +5932,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -6446,7 +6186,7 @@ your game set to use Phaser.AUTO then swap it for Phaser.CANVAS to ensure WebGL
    Source:
    @@ -6939,7 +6679,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 Sat Feb 08 2014 07:19:53 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:28 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.Utils.html b/docs/Phaser.Utils.html index 13275310..1bef0dbf 100644 --- a/docs/Phaser.Utils.html +++ b/docs/Phaser.Utils.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -972,7 +980,7 @@ dir = 1 (left), 2 (right), 3 (both)

    -

    Description.

    +

    The number of characters to be added.

    @@ -1007,7 +1015,7 @@ dir = 1 (left), 2 (right), 3 (both)

    -

    the string to pad it out with (defaults to a space).

    +

    The string to pad it out with (defaults to a space).

    @@ -1046,7 +1054,7 @@ dir = 1 (left), 2 (right), 3 (both)

    -

    the direction dir = 1 (left), 2 (right), 3 (both).

    +

    The direction dir = 1 (left), 2 (right), 3 (both).

    @@ -1293,7 +1301,7 @@ dir = 1 (left), 2 (right), 3 (both)

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:53 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:28 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.World.html b/docs/Phaser.World.html index 72de4a0d..a7cd8bce 100644 --- a/docs/Phaser.World.html +++ b/docs/Phaser.World.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -808,7 +816,7 @@ the world at world-based coordinates. By default a world is created the same siz
    Source:
    @@ -920,7 +928,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -1140,6 +1148,113 @@ So if you want to make a game in which the world itself will rotate you should a +
    + + + +
    + + + +
    +

    cameraOffset

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

    If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + +
    @@ -1233,7 +1348,7 @@ So if you want to make a game in which the world itself will rotate you should a
    Source:
    @@ -1335,7 +1450,7 @@ So if you want to make a game in which the world itself will rotate you should a
    Source:
    @@ -1549,7 +1664,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -1668,6 +1783,119 @@ The cursor is set to the first child added to the Group and doesn't change unles + + + + + + + + +
    +

    fixedToCamera

    + + +
    +
    + +
    +

    A Group that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Group.cameraOffset. +Note that the cameraOffset values are in addition to any parent in the display list. +So if this Group was in a Group that has x: 200, then this will be added to the cameraOffset.x

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

    Set to true to fix this Group to the Camera at its current world coordinates.

    +
    + + + + + + + + +
    Inherited From:
    +
    + + + + + + + + + + + + + +
    Source:
    +
    + + + + + + +
    @@ -1868,7 +2096,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -1975,7 +2203,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -2184,7 +2412,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -2286,7 +2514,7 @@ The cursor is set to the first child added to the Group and doesn't change unles
    Source:
    @@ -2398,7 +2626,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2505,7 +2733,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2612,7 +2840,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2826,7 +3054,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -2928,7 +3156,7 @@ This will have no impact on the rotation value of its children, but it will upda
    Source:
    @@ -3040,7 +3268,7 @@ This will have no impact on the x/y coordinates of its children, but it will upd
    Source:
    @@ -3152,7 +3380,7 @@ This will have no impact on the x/y coordinates of its children, but it will upd
    Source:
    @@ -3273,7 +3501,7 @@ that then see the addAt method.

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

    Source:
    @@ -3645,7 +3873,7 @@ The child is added to the Group at the location specified by the index value, th
    Source:
    @@ -3860,7 +4088,7 @@ The child is added to the Group at the location specified by the index value, th
    Source:
    @@ -4099,7 +4327,7 @@ After the method parameter and context you can add as many extra parameters as y
    Source:
    @@ -4297,7 +4525,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -4466,7 +4694,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -4540,7 +4768,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -4637,7 +4865,7 @@ After the existsValue parameter you can add as many parameters as you like, whic
    Source:
    @@ -4949,7 +5177,7 @@ Useful if you don't need to create the Sprite instances before-hand.

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

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

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

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

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

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

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

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

    Source:
    @@ -6326,7 +6554,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -6424,7 +6652,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -6570,7 +6798,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -6716,7 +6944,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -6885,7 +7113,7 @@ This is handy for checking if everything has been wiped out, or choosing a squad
    Source:
    @@ -7195,7 +7423,7 @@ You can add as many callback parameters as you like, which will all be passed to
    Source:
    @@ -7411,7 +7639,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.

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

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

    -

    postUpdate()

    +

    <protected> postUpdate()

    @@ -7521,10 +7749,7 @@ Group.multiplyAll('x', 2) will x2 the child.x value.

    -

    This is called automatically before the renderer runs and after the plugins have updated. -In postUpdate this is where all the final physics calculatations and object positioning happens. -The objects are processed in the order of the display list. -The only exception to this is if the camera is following an object, in which case that is updated first.

    +

    The core postUpdate - as called by World.

    @@ -7543,6 +7768,11 @@ The only exception to this is if the camera is following an object, in which cas +
    Inherited From:
    +
    + @@ -7557,7 +7787,7 @@ The only exception to this is if the camera is following an object, in which cas
    Source:
    @@ -7585,7 +7815,7 @@ The only exception to this is if the camera is following an object, in which cas
    -

    preUpdate()

    +

    <protected> preUpdate()

    @@ -7593,8 +7823,7 @@ The only exception to this is if the camera is following an object, in which cas
    -

    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.

    +

    The core preUpdate - as called by World.

    @@ -7613,6 +7842,11 @@ Most objects have preUpdate methods and it's where initial movement, drawing and +
    Inherited From:
    +
    + @@ -7627,7 +7861,7 @@ Most objects have preUpdate methods and it's where initial movement, drawing and
    Source:
    @@ -7701,7 +7935,7 @@ Most objects have preUpdate methods and it's where initial movement, drawing and
    Source:
    @@ -7824,7 +8058,7 @@ Most objects have preUpdate methods and it's where initial movement, drawing and
    Source:
    @@ -7922,7 +8156,7 @@ The Group container remains on the display list.

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

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

    Source:
    @@ -8541,7 +8775,7 @@ The operation parameter controls how the new value is assigned to the property,
    Source:
    @@ -8833,7 +9067,7 @@ The operation parameter controls how the new value is assigned to the property,
    Source:
    @@ -9020,7 +9254,7 @@ The operation parameter controls how the new value is assigned to the property,
    Source:
    @@ -9268,7 +9502,7 @@ The operation parameter controls how the new value is assigned to the property,
    Source:
    @@ -9451,7 +9685,7 @@ For example to depth sort Sprites for Zelda-style game you might call grou
    Source:
    @@ -9644,7 +9878,7 @@ Group.subAll('x', 10) will minus 10 from the child.x value.

    Source:
    @@ -9791,7 +10025,7 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
    Source:
    @@ -9819,7 +10053,7 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
    -

    update()

    +

    <protected> update()

    @@ -9827,8 +10061,7 @@ You cannot swap a child with itself, or swap un-parented children, doing so will
    -

    This is called automatically after the State.update, but before particles or plugins update. -Most objects won't have an update method set unless explicitly given one.

    +

    The core update - as called by World.

    @@ -9847,6 +10080,11 @@ Most objects won't have an update method set unless explicitly given one.

    +
    Inherited From:
    +
    + @@ -9861,7 +10099,7 @@ Most objects won't have an update method set unless explicitly given one.

    Source:
    @@ -9912,7 +10150,7 @@ Most objects won't have an update method set unless explicitly given one.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:53 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:28 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.html b/docs/Phaser.html index 2c8d0676..3a0188c4 100644 --- a/docs/Phaser.html +++ b/docs/Phaser.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -523,6 +531,9 @@
    BitmapData
    +
    BitmapFont
    +
    +
    BitmapText
    @@ -547,10 +558,10 @@
    Device
    -
    DOMSprite
    +
    Easing
    -
    Easing
    +
    Ellipse
    Events
    @@ -655,9 +666,6 @@
    RenderTexture
    -
    RenderTexture
    -
    -
    RequestAnimationFrame
    @@ -676,7 +684,7 @@
    Sprite
    -
    Sprite
    +
    SpriteBatch
    Stage
    @@ -767,7 +775,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Phaser.js.html b/docs/Phaser.js.html index 51548077..cb447ca5 100644 --- a/docs/Phaser.js.html +++ b/docs/Phaser.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -471,7 +479,7 @@ var Phaser = Phaser || { SPRITE: 0, BUTTON: 1, - BULLET: 2, + IMAGE: 2, GRAPHICS: 3, TEXT: 4, TILESPRITE: 5, @@ -485,6 +493,9 @@ var Phaser = Phaser || { BITMAPDATA: 13, CANVAS_FILTER: 14, WEBGL_FILTER: 15, + ELLIPSE: 16, + SPRITEBATCH: 17, + BITMAPFONT: 18, NONE: 0, LEFT: 1, @@ -492,6 +503,10 @@ var Phaser = Phaser || { UP: 3, DOWN: 4, + DYNAMIC: 1, + STATIC: 2, + KINEMATIC: 4, + CANVAS_PX_ROUND: false, CANVAS_CLEAR_RECT: true @@ -522,7 +537,7 @@ PIXI.InteractionManager = function (dummy) { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Plugin.js.html b/docs/Plugin.js.html index 65c12d15..a6719d00 100644 --- a/docs/Plugin.js.html +++ b/docs/Plugin.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -593,7 +601,7 @@ Phaser.Plugin.prototype.constructor = Phaser.Plugin; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/PluginManager.js.html b/docs/PluginManager.js.html index d7aab5e4..1d8b282a 100644 --- a/docs/PluginManager.js.html +++ b/docs/PluginManager.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -769,7 +777,7 @@ Phaser.PluginManager.prototype.constructor = Phaser.PluginManager; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Point.js.html b/docs/Point.js.html index 4029a52e..87c7b2f2 100644 --- a/docs/Point.js.html +++ b/docs/Point.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -929,7 +937,7 @@ PIXI.Point = Phaser.Point; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Pointer.js.html b/docs/Pointer.js.html index 5f633965..1be18cb8 100644 --- a/docs/Pointer.js.html +++ b/docs/Pointer.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -658,7 +666,7 @@ Phaser.Pointer.prototype = { } // Fix to stop rogue browser plugins from blocking the visibility state event - if (this.game.stage.disableVisibilityChange === false && this.game.paused && this.game.stage.scale.incorrectOrientation === false) + if (this.game.stage.disableVisibilityChange === false && this.game.paused && this.game.scale.incorrectOrientation === false) { this.game.paused = false; return this; @@ -676,12 +684,12 @@ Phaser.Pointer.prototype = { this._holdSent = false; // This sets the x/y and other local values - this.move(event); + this.move(event, true); // x and y are the old values here? this.positionDown.setTo(this.x, this.y); - if (this.game.input.multiInputOverride == Phaser.Input.MOUSE_OVERRIDES_TOUCH || this.game.input.multiInputOverride == Phaser.Input.MOUSE_TOUCH_COMBINE || (this.game.input.multiInputOverride == Phaser.Input.TOUCH_OVERRIDES_MOUSE && this.game.input.currentPointers === 0)) + if (this.game.input.multiInputOverride === Phaser.Input.MOUSE_OVERRIDES_TOUCH || this.game.input.multiInputOverride === Phaser.Input.MOUSE_TOUCH_COMBINE || (this.game.input.multiInputOverride === Phaser.Input.TOUCH_OVERRIDES_MOUSE && this.game.input.currentPointers === 0)) { this.game.input.x = this.x; this.game.input.y = this.y; @@ -693,7 +701,7 @@ Phaser.Pointer.prototype = { this._stateReset = false; this.totalTouches++; - if (this.isMouse === false) + if (!this.isMouse) { this.game.input.currentPointers++; } @@ -748,14 +756,17 @@ Phaser.Pointer.prototype = { * Called when the Pointer is moved. * @method Phaser.Pointer#move * @param {MouseEvent|PointerEvent|TouchEvent} event - The event passed up from the input handler. + * @param {boolean} [fromClick=false] - Was this called from the click event? */ - move: function (event) { + move: function (event, fromClick) { if (this.game.input.pollLocked) { return; } + if (typeof fromClick === 'undefined') { fromClick = false; } + if (typeof event.button !== 'undefined') { this.button = event.button; @@ -822,11 +833,10 @@ Phaser.Pointer.prototype = { do { // If the object is using pixelPerfect checks, or has a higher InputManager.PriorityID OR if the priority ID is the same as the current highest AND it has a higher renderOrderID, then set it to the top - if (currentNode.pixelPerfect || currentNode.priorityID > this._highestInputPriorityID || (currentNode.priorityID == this._highestInputPriorityID && currentNode.sprite.renderOrderID > this._highestRenderOrderID)) + if (currentNode.pixelPerfectClick || currentNode.pixelPerfectOver || currentNode.priorityID > this._highestInputPriorityID || (currentNode.priorityID === this._highestInputPriorityID && currentNode.sprite.renderOrderID > this._highestRenderOrderID)) { - if (currentNode.checkPointerOver(this)) + if ((!fromClick && currentNode.checkPointerOver(this)) || (fromClick && currentNode.checkPointerDown(this))) { - // console.log('HRO set', currentNode.sprite.name); this._highestRenderOrderID = currentNode.sprite.renderOrderID; this._highestInputPriorityID = currentNode.priorityID; this._highestRenderObject = currentNode; @@ -837,7 +847,7 @@ Phaser.Pointer.prototype = { while (currentNode != null) } - if (this._highestRenderObject == null) + if (this._highestRenderObject === null) { // The pointer isn't currently over anything, check if we've got a lingering previous target if (this.targetObject) @@ -849,7 +859,7 @@ Phaser.Pointer.prototype = { } else { - if (this.targetObject == null) + if (this.targetObject === null) { // And now set the new one // console.log('And now set the new one'); @@ -860,7 +870,7 @@ Phaser.Pointer.prototype = { { // We've got a target from the last update // console.log("We've got a target from the last update"); - if (this.targetObject == this._highestRenderObject) + if (this.targetObject === this._highestRenderObject) { // Same target as before, so update it // console.log("Same target as before, so update it"); @@ -894,7 +904,7 @@ Phaser.Pointer.prototype = { leave: function (event) { this.withinGame = false; - this.move(event); + this.move(event, false); }, @@ -1114,7 +1124,7 @@ Object.defineProperty(Phaser.Pointer.prototype, "worldY", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Polygon.js.html b/docs/Polygon.js.html index 7b2d953b..7b0bc4f7 100644 --- a/docs/Polygon.js.html +++ b/docs/Polygon.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -451,6 +459,7 @@
    /**
     * @author       Richard Davey <rich@photonstorm.com>
    +* @author       Adrien Brault <adrien.brault@gmail.com>
     * @copyright    2014 Photon Storm Ltd.
     * @license      {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
     */
    @@ -458,8 +467,8 @@
     /**
     * Creates a new Polygon. You have to provide a list of points.
     * This can be an array of Points that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], 
    -* or the arguments passed can be all the points of the polygon e.g. `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the
    -* arguments passed can be flat x,y values e.g. `new PIXI.Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are numbers.
    +* or the arguments passed can be all the points of the polygon e.g. `new Phaser.Polygon(new Phaser.Point(), new Phaser.Point(), ...)`, or the
    +* arguments passed can be flat x,y values e.g. `new Phaser.Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are numbers.
     *
     * @class Phaser.Polygon
     * @classdesc The polygon represents a list of orderded points in space
    @@ -468,17 +477,97 @@
     */
     Phaser.Polygon = function (points) {
     
    -    PIXI.Polygon.call(this, points);
    -
         /**
         * @property {number} type - The base object type.
         */
         this.type = Phaser.POLYGON;
     
    +    //if points isn't an array, use arguments as the array
    +    if (!(points instanceof Array))
    +    {
    +        points = Array.prototype.slice.call(arguments);
    +    }
    +
    +    //if this is a flat array of numbers, convert it to points
    +    if (typeof points[0] === 'number')
    +    {
    +        var p = [];
    +
    +        for (var i = 0, len = points.length; i < len; i += 2)
    +        {
    +            p.push(new Phaser.Point(points[i], points[i + 1]));
    +        }
    +
    +        points = p;
    +    }
    +
    +    /**
    +    * @property {array<Phaser.Point>|array<number>} points - The array of Points.
    +    */
    +    this.points = points;
    +
     };
     
    -Phaser.Polygon.prototype = Object.create(PIXI.Polygon.prototype);
    -Phaser.Polygon.prototype.constructor = Phaser.Polygon;
    +Phaser.Polygon.prototype = { + + /** + * Creates a clone of this polygon. + * + * @method Phaser.Polygon#clone + * @return {Phaser.Polygon} A copy of the polygon. + */ + clone: function () { + + var points = []; + + for (var i=0; i < this.points.length; i++) + { + points.push(this.points[i].clone()); + } + + return new Phaser.Polygon(points); + + }, + + /** + * Checks whether the x and y coordinates are contained within this polygon. + * + * @method Phaser.Polygon#contains + * @param {number} x - The X value of the coordinate to test. + * @param {number} y - The Y value of the coordinate to test. + * @return {boolean} True if the coordinates are within this polygon, otherwise false. + */ + contains: function (x, y) { + + var inside = false; + + // use some raycasting to test hits https://github.com/substack/point-in-polygon/blob/master/index.js + for (var i = 0, j = this.points.length - 1; i < this.points.length; j = i++) + { + var xi = this.points[i].x; + var yi = this.points[i].y; + var xj = this.points[j].x; + var yj = this.points[j].y; + + var intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi); + + if (intersect) + { + inside = true; + } + } + + return inside; + + } + +}; + +Phaser.Polygon.prototype.constructor = Phaser.Polygon; + +// Because PIXI uses its own Polygon, we'll replace it with ours to avoid duplicating code or confusion. +PIXI.Polygon = Phaser.Polygon; +
    @@ -499,7 +588,7 @@ Phaser.Polygon.prototype.constructor = Phaser.Polygon; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/QuadTree.js.html b/docs/QuadTree.js.html index de48b23f..95f7c93a 100644 --- a/docs/QuadTree.js.html +++ b/docs/QuadTree.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -757,7 +765,7 @@ Phaser.QuadTree.prototype.constructor = Phaser.QuadTree; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/RandomDataGenerator.js.html b/docs/RandomDataGenerator.js.html index 436502a1..b3692a99 100644 --- a/docs/RandomDataGenerator.js.html +++ b/docs/RandomDataGenerator.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -719,7 +727,7 @@ Phaser.RandomDataGenerator.prototype.constructor = Phaser.RandomDataGenerator; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Rectangle.js.html b/docs/Rectangle.js.html index 8287a74d..7677782a 100644 --- a/docs/Rectangle.js.html +++ b/docs/Rectangle.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1246,7 +1254,7 @@ PIXI.EmptyRectangle = new Phaser.Rectangle(0, 0, 0, 0); Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/RenderTexture.js.html b/docs/RenderTexture.js.html index 192f88da..d2194300 100644 --- a/docs/RenderTexture.js.html +++ b/docs/RenderTexture.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -508,7 +516,7 @@ Phaser.RenderTexture.prototype.constructor = Phaser.RenderTexture; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/RequestAnimationFrame.js.html b/docs/RequestAnimationFrame.js.html index d6a1375f..2560c19d 100644 --- a/docs/RequestAnimationFrame.js.html +++ b/docs/RequestAnimationFrame.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -629,7 +637,7 @@ Phaser.RequestAnimationFrame.prototype.constructor = Phaser.RequestAnimationFram Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Signal.js.html b/docs/Signal.js.html index d9630889..7fa81c19 100644 --- a/docs/Signal.js.html +++ b/docs/Signal.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -774,7 +782,7 @@ Phaser.Signal.prototype.constructor = Phaser.Signal; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/SignalBinding.html b/docs/SignalBinding.html index cc07418e..46e87ac0 100644 --- a/docs/SignalBinding.html +++ b/docs/SignalBinding.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -767,7 +775,7 @@ Inspired by Joa Ebert AS3 SignalBinding and Robert Penner's Slot classes.

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:53 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:29 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/SignalBinding.js.html b/docs/SignalBinding.js.html index 823a47f6..4d4b51bf 100644 --- a/docs/SignalBinding.js.html +++ b/docs/SignalBinding.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -634,7 +642,7 @@ Phaser.SignalBinding.prototype.constructor = Phaser.SignalBinding; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/SinglePad.js.html b/docs/SinglePad.js.html index 79235ff1..f21a18f6 100644 --- a/docs/SinglePad.js.html +++ b/docs/SinglePad.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1039,7 +1047,7 @@ Object.defineProperty(Phaser.SinglePad.prototype, "index", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Sound.js.html b/docs/Sound.js.html index b1e79fca..17d6046a 100644 --- a/docs/Sound.js.html +++ b/docs/Sound.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1295,7 +1303,7 @@ Object.defineProperty(Phaser.Sound.prototype, "volume", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/SoundManager.js.html b/docs/SoundManager.js.html index e36bc9a3..9539aaf8 100644 --- a/docs/SoundManager.js.html +++ b/docs/SoundManager.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -952,7 +960,7 @@ Object.defineProperty(Phaser.SoundManager.prototype, "volume", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Sprite.js.html b/docs/Sprite.js.html index 17059fa6..a762b320 100644 --- a/docs/Sprite.js.html +++ b/docs/Sprite.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -482,12 +490,6 @@ Phaser.Sprite = function (game, x, y, key, frame) { * @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. @@ -549,23 +551,15 @@ Phaser.Sprite = function (game, x, y, key, frame) { */ 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 {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. + * @property {Phaser.Physics.Body|null} body - The Sprites physics Body. Will be null unless physics has been enabled via `Sprite.physicsEnabled = true`. */ - this.body = new Phaser.Physics.Arcade.Body(this); + this.body = null; /** * @property {number} health - Health value. Used in combination with damage() to allow for quick killing of Sprites. @@ -581,11 +575,20 @@ Phaser.Sprite = function (game, x, y, key, frame) { this.lifespan = 0; /** - * @property {boolean} outOfBoundsKill - If true the Sprite is killed as soon as Sprite.inWorld is false. + * If true the Sprite checks if it is still within the world each frame, when it leaves the world it dispatches Sprite.events.onOutOfBounds + * and optionally kills the sprite (if Sprite.outOfBoundsKill is true). By default this is disabled because the Sprite has to calculate its + * bounds every frame to support it, and not all games need it. Enable it by setting the value to true. + * @property {boolean} checkWorldBounds + * @default + */ + this.checkWorldBounds = false; + + /** + * @property {boolean} outOfBoundsKill - If true Sprite.kill is called as soon as Sprite.inWorld returns false, as long as Sprite.checkWorldBounds is true. * @default */ this.outOfBoundsKill = false; - + /** * @property {boolean} debug - Handy flag to use with Game.enableStep * @default @@ -593,16 +596,30 @@ Phaser.Sprite = function (game, x, y, key, frame) { this.debug = false; /** - * @property {boolean} _outOfBoundsFired - Internal flag. - * @private + * @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view. */ - this._outOfBoundsFired = false; + this.cameraOffset = new Phaser.Point(); /** - * @property {array} _cache - A small cache for previous step values. 0 = x, 1 = y, 2 = rotation, 3 = renderID, 4 = fresh? (0 = no, 1 = yes) + * A small internal cache: + * 0 = previous position.x + * 1 = previous position.y + * 2 = previous rotation + * 3 = renderID + * 4 = fresh? (0 = no, 1 = yes) + * 5 = outOfBoundsFired (0 = no, 1 = yes) + * 6 = exists (0 = no, 1 = yes) + * 7 = fixed to camera (0 = no, 1 = yes) + * @property {Int16Array} _cache * @private */ - this._cache = [0, 0, 0, 0, 1]; + this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0]); + + /** + * @property {Phaser.Rectangle} _bounds - Internal cache var. + * @private + */ + this._bounds = new Phaser.Rectangle(); }; @@ -614,29 +631,29 @@ Phaser.Sprite.prototype.constructor = Phaser.Sprite; * * @method Phaser.Sprite#preUpdate * @memberof Phaser.Sprite +* @return {boolean} True if the Sprite was rendered, otherwise false. */ Phaser.Sprite.prototype.preUpdate = function() { if (this._cache[4] === 1) { - 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[0] = this.world.x; - // this._cache[1] = this.world.y; - // this._cache[2] = this.rotation; + this.worldTransform.tx = this.world.x; + this.worldTransform.ty = this.world.y; + this._cache[0] = this.world.x; + this._cache[1] = this.world.y; + this._cache[2] = this.rotation; this._cache[4] = 0; - if (this.body) - { - this.body.x = (this.world.x - (this.anchor.x * this.width)) + this.body.offset.x; - this.body.y = (this.world.y - (this.anchor.y * this.height)) + this.body.offset.y; - this.body.preX = this.body.x; - this.body.preY = this.body.y; - } + // if (this.body) + // { + // this.body.x = (this.world.x - (this.anchor.x * this.width)) + this.body.offset.x; + // this.body.y = (this.world.y - (this.anchor.y * this.height)) + this.body.offset.y; + // this.body.preX = this.body.x; + // this.body.preY = this.body.y; + // } - return; + return false; } this._cache[0] = this.world.x; @@ -645,7 +662,8 @@ Phaser.Sprite.prototype.preUpdate = function() { if (!this.exists || !this.parent.exists) { - this.renderOrderID = -1; + // Reset the renderOrderID + this._cache[3] = -1; return false; } @@ -660,13 +678,40 @@ Phaser.Sprite.prototype.preUpdate = function() { } } + // Cache the bounds if we need it + if (this.autoCull || this.checkWorldBounds) + { + this._bounds.copyFrom(this.getBounds()); + } + 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.renderable = this.game.world.camera.screenView.intersects(this._bounds); } - this.world.setTo(this.game.camera.x + this.worldTransform[2], this.game.camera.y + this.worldTransform[5]); + if (this.checkWorldBounds) + { + // The Sprite is already out of the world bounds, so let's check to see if it has come back again + if (this._cache[5] === 1 && this.game.world.bounds.intersects(this._bounds)) + { + this._cache[5] = 0; + } + else if (this._cache[5] === 0 && !this.game.world.bounds.intersects(this._bounds)) + { + // The Sprite WAS in the screen, but has now left. + this._cache[5] = 1; + this.events.onOutOfBounds.dispatch(this); + + if (this.outOfBoundsKill) + { + this.kill(); + return false; + } + } + } + + this.world.setTo(this.game.camera.x + this.worldTransform.tx, this.game.camera.y + this.worldTransform.ty); if (this.visible) { @@ -675,45 +720,25 @@ Phaser.Sprite.prototype.preUpdate = function() { this.animations.update(); - if (!this.inWorld && Phaser.Rectangle.intersects(this.getBounds(), this.game.world.bounds, this.inWorldThreshold)) - { - // 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.getBounds(), this.game.world.bounds, this.inWorldThreshold); - - if (this.inWorld === false) - { - this.events.onOutOfBounds.dispatch(this); - this._outOfBoundsFired = true; - - if (this.outOfBoundsKill) - { - this.kill(); - } - } - } - - this._cache.cameraVisible = Phaser.Rectangle.intersects(this.game.world.camera.screenView, this.getBounds(), 0); - - if (this.autoCull) - { - // Won't get rendered but will still get its transform updated - this.renderable = this._cache.cameraVisible; - } - if (this.body) { - this.body.preUpdate(); + // this.body.preUpdate(); } return true; }; +/** +* Override and use this function in your own custom objects to handle any update requirements you may have. +* +* @method Phaser.Sprite#update +* @memberof Phaser.Sprite +*/ +Phaser.Sprite.prototype.update = function() { + +}; + /** * Internal function called by the World postUpdate cycle. * @@ -733,12 +758,13 @@ Phaser.Sprite.prototype.postUpdate = function() { { this.body.postUpdate(); } + } - if (this.fixedToCamera) - { - // this.position.x = this.game.camera.view.x + this.x; - // this.position.y = this.game.camera.view.y + this.y; - } + // Fixed to Camera? + if (this._cache[7] === 1) + { + this.position.x = this.game.camera.view.x + this.cameraOffset.x; + this.position.y = this.game.camera.view.y + this.cameraOffset.y; } }; @@ -760,16 +786,19 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame) { { this.key = key.key; this.setTexture(key); + return; } else if (key instanceof Phaser.BitmapData) { this.key = key.key; this.setTexture(key.texture); + return; } else if (key instanceof PIXI.Texture) { this.key = key; this.setTexture(key); + return; } else { @@ -777,11 +806,13 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame) { { this.key = '__default'; this.setTexture(PIXI.TextureCache[this.key]); + return; } else if (typeof key === 'string' && !this.game.cache.checkImageKey(key)) { this.key = '__missing'; this.setTexture(PIXI.TextureCache[this.key]); + return; } if (this.game.cache.isSpriteSheet(key)) @@ -804,18 +835,19 @@ Phaser.Sprite.prototype.loadTexture = function (key, frame) { { this.key = key; this.setTexture(PIXI.TextureCache[key]); + return; } } }; /** -* 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. +* Crop allows you to crop the texture used to display this Sprite. +* Cropping takes place from the top-left of the Sprite and can be modified in real-time by providing an updated rectangle object. * * @method Phaser.Sprite#crop * @memberof Phaser.Sprite -* @param {Phaser.Rectangle} rect - The Rectangle to crop the Image to. Pass null or no parameters to clear a previously set crop rectangle. +* @param {Phaser.Rectangle} rect - The Rectangle to crop the Sprite to. Pass null or no parameters to clear a previously set crop rectangle. */ Phaser.Sprite.prototype.crop = function(rect) { @@ -928,11 +960,6 @@ Phaser.Sprite.prototype.destroy = function() { this.parent.remove(this); } - if (this.events) - { - this.events.destroy(); - } - if (this.input) { this.input.destroy(); @@ -948,6 +975,11 @@ Phaser.Sprite.prototype.destroy = function() { this.body.destroy(); } + if (this.events) + { + this.events.destroy(); + } + this.alive = false; this.exists = false; this.visible = false; @@ -1010,7 +1042,7 @@ Phaser.Sprite.prototype.reset = function(x, y, health) { if (this.body) { - this.body.reset(false); + this.body.reset(x, y, false, false); } return this; @@ -1070,7 +1102,7 @@ Phaser.Sprite.prototype.play = function (name, frameRate, loop, killOnComplete) * 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. +* @property {number} angle - The angle of this Sprite in degrees. */ Object.defineProperty(Phaser.Sprite.prototype, "angle", { @@ -1140,10 +1172,10 @@ Object.defineProperty(Phaser.Sprite.prototype, "deltaZ", { }); /** -* Checks if the Image bounds are within the game world, otherwise false if fully outside of it. +* Checks if the Sprite 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. +* @property {boolean} inWorld - True if the Sprite bounds is within the game world, even if only partially. Otherwise false if fully outside of it. * @readonly */ Object.defineProperty(Phaser.Sprite.prototype, "inWorld", { @@ -1157,10 +1189,10 @@ Object.defineProperty(Phaser.Sprite.prototype, "inWorld", { }); /** -* Checks if the Image bounds are within the game camera, otherwise false if fully outside of it. +* Checks if the Sprite 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. +* @property {boolean} inCamera - True if the Sprite bounds is within the game camera, even if only partially. Otherwise false if fully outside of it. * @readonly */ Object.defineProperty(Phaser.Sprite.prototype, "inCamera", { @@ -1221,7 +1253,7 @@ Object.defineProperty(Phaser.Sprite.prototype, "renderOrderID", { }); /** -* By default an Image won't process any input events at all. By setting inputEnabled to true the Phaser.InputHandler is +* By default a Sprite 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 @@ -1254,6 +1286,125 @@ Object.defineProperty(Phaser.Sprite.prototype, "inputEnabled", { } } +}); + +/** +* By default Sprites won't add themselves to the physics world. By setting physicsEnabled to true a Rectangle physics body is +* attached to this Sprite matching its placement and dimensions, and will then start to process physics world updates. +* You can access all physics related properties via Sprite.body. +* +* Important: Enabling a Sprite for physics will automatically set `Sprite.anchor` to 0.5 s0 the physics body is centered on the Sprite. +* If you need a different result then adjust or re-create the Body shape offsets manually, and/or reset the anchor after enabling physics. +* +* @name Phaser.Sprite#physicsEnabled +* @property {boolean} physicsEnabled - Set to true to add this Sprite to the physics world. Set to false to destroy the body and remove it from the physics world. +*/ +Object.defineProperty(Phaser.Sprite.prototype, "physicsEnabled", { + + get: function () { + + return (this.body !== null); + + }, + + set: function (value) { + + if (value) + { + if (this.body === null) + { + this.body = new Phaser.Physics.Body(this.game, this, this.x, this.y, 1); + this.anchor.set(0.5); + } + } + else + { + if (this.body) + { + this.body.destroy(); + } + } + } + +}); + +/** +* Sprite.exists controls if the core game loop and physics update this Sprite or not. +* When you set Sprite.exists to false it will remove its Body from the physics world (if it has one) and also set Sprite.visible to false. +* Setting Sprite.exists to true will re-add the Body to the physics world (if it has a body) and set Sprite.visible to true. +* +* @name Phaser.Sprite#exists +* @property {boolean} exists - If the Sprite is processed by the core game update and physics. +*/ +Object.defineProperty(Phaser.Sprite.prototype, "exists", { + + get: function () { + + return !!this._cache[6]; + + }, + + set: function (value) { + + if (value) + { + // exists = true + this._cache[6] = 1; + + if (this.body) + { + this.body.addToWorld(); + } + + this.visible = true; + } + else + { + // exists = false + this._cache[6] = 0; + + if (this.body) + { + this.body.removeFromWorld(); + } + + this.visible = false; + + } + } + +}); + + +/** +* An Sprite that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Sprite.cameraOffset. +* Note that the cameraOffset values are in addition to any parent in the display list. +* So if this Sprite was in a Group that has x: 200, then this will be added to the cameraOffset.x +* +* @name Phaser.Sprite#fixedToCamera +* @property {boolean} fixedToCamera - Set to true to fix this Sprite to the Camera at its current world coordinates. +*/ +Object.defineProperty(Phaser.Sprite.prototype, "fixedToCamera", { + + get: function () { + + return !!this._cache[7]; + + }, + + set: function (value) { + + if (value) + { + this._cache[7] = 1; + this.cameraOffset.set(this.x, this.y); + } + else + { + this._cache[7] = 0; + } + } + }); @@ -1276,7 +1427,7 @@ Object.defineProperty(Phaser.Sprite.prototype, "inputEnabled", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/SpriteBatch.js.html b/docs/SpriteBatch.js.html new file mode 100644 index 00000000..ef84d393 --- /dev/null +++ b/docs/SpriteBatch.js.html @@ -0,0 +1,556 @@ + + + + + + Phaser Source: gameobjects/SpriteBatch.js + + + + + + + + + + +
    + + +
    + + +
    + +
    + + + +

    Source: gameobjects/SpriteBatch.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}
    +*/
    +
    +/**
    +* Phaser SpriteBatch constructor.
    +*
    +* @classdesc The SpriteBatch class is a really fast version of the DisplayObjectContainer built solely for speed, so use when you need a lot of sprites or particles.
    +* @class Phaser.SpriteBatch
    +* @extends Phaser.Group
    +* @constructor
    +* @param {Phaser.Game} game - A reference to the currently running game.
    +* @param {Phaser.Group|Phaser.Sprite} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined or null it will use game.world.
    +* @param {string} [name=group] - A name for this Group. Not used internally but useful for debugging.
    +* @param {boolean} [addToStage=false] - If set to true this Group will be added directly to the Game.Stage instead of Game.World.
    +*/
    +Phaser.SpriteBatch = function (game, parent, name, addToStage) {
    +
    +    PIXI.SpriteBatch.call(this);
    +
    +    Phaser.Group.call(this, game, parent, name, addToStage);
    +
    +    /**
    +    * @property {number} type - Internal Phaser Type value.
    +    * @protected
    +    */
    +    this.type = Phaser.SPRITEBATCH;
    +
    +};
    +
    +Phaser.SpriteBatch.prototype = Phaser.Utils.extend(true, Phaser.SpriteBatch.prototype, Phaser.Group.prototype, PIXI.SpriteBatch.prototype);
    +
    +Phaser.SpriteBatch.prototype.constructor = Phaser.SpriteBatch;
    +
    +
    +
    + + + + + +
    + +
    +
    + + + + Phaser Copyright © 2012-2014 Photon Storm Ltd. + +
    + + + Documentation generated by JSDoc 3.3.0-dev + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. + +
    +
    + + +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + diff --git a/docs/Stage.js.html b/docs/Stage.js.html index 9a68cd74..008cc18c 100644 --- a/docs/Stage.js.html +++ b/docs/Stage.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -460,6 +468,7 @@ * focus handling, game resizing, scaling and the pause, boot and orientation screens. * * @class Phaser.Stage +* @extends PIXI.Stage * @constructor * @param {Phaser.Game} game - Game reference to the currently running game. * @param {number} width - Width of the canvas element. @@ -473,53 +482,19 @@ Phaser.Stage = function (game, width, height) { this.game = game; /** - * @property {string} game - Background color of the stage (defaults to black). Set via the public backgroundColor property. - * @private - */ - this._backgroundColor = 'rgb(0,0,0)'; - - /** - * @property {Phaser.Point} offset - Get the offset values (for input and other things). + * @property {Phaser.Point} offset - Holds the offset coordinates of the Game.canvas from the top-left of the browser window (used by Input and other classes) */ this.offset = new Phaser.Point(); - /** - * @property {HTMLCanvasElement} canvas - Reference to the newly created `canvas` element. - */ - this.canvas = null; - - /** - * @property {PIXI.Stage} _stage - The Pixi Stage which is hooked to the renderer. - * @private - */ - this._stage = new PIXI.Stage(0x000000, false); - this._stage.name = '_stage_root'; - this._stage.interactive = false; + PIXI.Stage.call(this, 0x000000, false); /** - * @property {PIXI.Stage} display - The Pixi Stage which is hooked to the renderer. + * @property {string} name - The name of this object. + * @default */ - this.display = this._stage; + this.name = '_stage_root'; - /** - * @property {number} scaleMode - The current scaleMode. - */ - this.scaleMode = Phaser.StageScaleMode.NO_SCALE; - - /* - * @property {number} fullScreenScaleMode - Scale mode to be used in fullScreen - */ - this.fullScreenScaleMode = Phaser.StageScaleMode.NO_SCALE; - - /** - * @property {Phaser.StageScaleMode} scale - The scale of the current running game. - */ - this.scale = new Phaser.StageScaleMode(this.game, width, height); - - /** - * @property {number} aspectRatio - Aspect ratio. - */ - this.aspectRatio = width / height; + this.interactive = false; /** * @property {boolean} disableVisibilityChange - By default if the browser tab loses focus the game will pause. You can stop that behaviour by setting this property to true. @@ -527,6 +502,18 @@ Phaser.Stage = function (game, width, height) { */ this.disableVisibilityChange = false; + /** + * @property {number|false} checkOffsetInterval - The time (in ms) between which the stage should check to see if it has moved. + * @default + */ + this.checkOffsetInterval = 2500; + + /** + * @property {boolean} exists - If exists is true the Stage and all children are updated, otherwise it is skipped. + * @default + */ + this.exists = true; + /** * @property {number} _nextOffsetCheck - The time to run the next offset check. * @private @@ -534,10 +521,10 @@ Phaser.Stage = function (game, width, height) { this._nextOffsetCheck = 0; /** - * @property {number|false} checkOffsetInterval - The time (in ms) between which the stage should check to see if it has moved. - * @default + * @property {number} _backgroundColor - Stage background color. + * @private */ - this.checkOffsetInterval = 2500; + this._backgroundColor; if (game.config) { @@ -545,144 +532,229 @@ Phaser.Stage = function (game, width, height) { } else { - this.canvas = Phaser.Canvas.create(width, height); - this.canvas.style['-webkit-full-screen'] = 'width: 100%; height: 100%'; - } - -}; - -Phaser.Stage.prototype = { - - /** - * Parses a Game configuration object. - * - * @method Phaser.Stage#parseConfig - * @protected - */ - parseConfig: function (config) { - - if (config['canvasID']) - { - this.canvas = Phaser.Canvas.create(this.game.width, this.game.height, config['canvasID']); - } - else - { - this.canvas = Phaser.Canvas.create(this.game.width, this.game.height); - } - - if (config['canvasStyle']) - { - this.canvas.stlye = config['canvasStyle']; - } - else - { - this.canvas.style['-webkit-full-screen'] = 'width: 100%; height: 100%'; - } - - if (config['checkOffsetInterval']) - { - this.checkOffsetInterval = config['checkOffsetInterval']; - } - - if (config['disableVisibilityChange']) - { - this.disableVisibilityChange = config['disableVisibilityChange']; - } - - if (config['fullScreenScaleMode']) - { - this.fullScreenScaleMode = config['fullScreenScaleMode']; - } - - if (config['scaleMode']) - { - this.scaleMode = config['scaleMode']; - } - - if (config['backgroundColor']) - { - this.backgroundColor = config['backgroundColor']; - } - - }, - - /** - * Initialises the stage and adds the event listeners. - * @method Phaser.Stage#boot - * @private - */ - boot: function () { - - Phaser.Canvas.getOffset(this.canvas, this.offset); - - this.bounds = new Phaser.Rectangle(this.offset.x, this.offset.y, this.game.width, this.game.height); - - var _this = this; - - this._onChange = function (event) { - return _this.visibilityChange(event); - } - - Phaser.Canvas.setUserSelect(this.canvas, 'none'); - Phaser.Canvas.setTouchAction(this.canvas, 'none'); - - this.backgroundColor = '#000'; - - document.addEventListener('visibilitychange', this._onChange, false); - document.addEventListener('webkitvisibilitychange', this._onChange, false); - document.addEventListener('pagehide', this._onChange, false); - document.addEventListener('pageshow', this._onChange, false); - - window.onblur = this._onChange; - window.onfocus = this._onChange; - - }, - - /** - * Runs Stage processes that need periodic updates, such as the offset checks. - * @method Phaser.Stage#update - */ - update: function () { - - if (this.checkOffsetInterval !== false) - { - if (this.game.time.now > this._nextOffsetCheck) - { - Phaser.Canvas.getOffset(this.canvas, this.offset); - this._nextOffsetCheck = this.game.time.now + this.checkOffsetInterval; - } - - } - - }, - - /** - * This method is called when the document visibility is changed. - * @method Phaser.Stage#visibilityChange - * @param {Event} event - Its type will be used to decide whether the game should be paused or not. - */ - visibilityChange: function (event) { - - if (this.disableVisibilityChange) - { - return; - } - - if (this.game.paused === false && (event.type == 'pagehide' || event.type == 'blur' || document['hidden'] === true || document['webkitHidden'] === true)) - { - this.game.paused = true; - } - else - { - this.game.paused = false; - } - + this.game.canvas = Phaser.Canvas.create(width, height); + this.game.canvas.style['-webkit-full-screen'] = 'width: 100%; height: 100%'; } }; +Phaser.Stage.prototype = Object.create(PIXI.Stage.prototype); Phaser.Stage.prototype.constructor = Phaser.Stage; +/** +* This is called automatically after the plugins preUpdate and before the State.update. +* Most objects have preUpdate methods and it's where initial movement and positioning is done. +* +* @method Phaser.Stage#preUpdate +*/ +Phaser.Stage.prototype.preUpdate = function () { + + this.currentRenderOrderID = 0; + + var i = this.children.length; + + while (i--) + { + this.children[i].preUpdate(); + } + +} + +/** +* This is called automatically after the State.update, but before particles or plugins update. +* +* @method Phaser.Stage#update +*/ +Phaser.Stage.prototype.update = function () { + + var i = this.children.length; + + while (i--) + { + this.children[i].update(); + } + +} + +/** +* This is called automatically before the renderer runs and after the plugins have updated. +* In postUpdate this is where all the final physics calculatations and object positioning happens. +* The objects are processed in the order of the display list. +* The only exception to this is if the camera is following an object, in which case that is updated first. +* +* @method Phaser.Stage#postUpdate +*/ +Phaser.Stage.prototype.postUpdate = function () { + + if (this.game.world.camera.target) + { + this.game.world.camera.target.postUpdate(); + + this.game.world.camera.update(); + + var i = this.children.length; + + while (i--) + { + if (this.children[i] !== this.game.world.camera.target) + { + this.children[i].postUpdate(); + } + } + } + else + { + this.game.world.camera.update(); + + var i = this.children.length; + + while (i--) + { + this.children[i].postUpdate(); + } + } + +} + +/** +* Parses a Game configuration object. +* +* @method Phaser.Stage#parseConfig +* @protected +*/ +Phaser.Stage.prototype.parseConfig = function (config) { + + if (config['canvasID']) + { + this.game.canvas = Phaser.Canvas.create(this.game.width, this.game.height, config['canvasID']); + } + else + { + this.game.canvas = Phaser.Canvas.create(this.game.width, this.game.height); + } + + if (config['canvasStyle']) + { + this.game.canvas.stlye = config['canvasStyle']; + } + else + { + this.game.canvas.style['-webkit-full-screen'] = 'width: 100%; height: 100%'; + } + + if (config['checkOffsetInterval']) + { + this.checkOffsetInterval = config['checkOffsetInterval']; + } + + if (config['disableVisibilityChange']) + { + this.disableVisibilityChange = config['disableVisibilityChange']; + } + + if (config['fullScreenScaleMode']) + { + this.fullScreenScaleMode = config['fullScreenScaleMode']; + } + + if (config['scaleMode']) + { + this.scaleMode = config['scaleMode']; + } + + if (config['backgroundColor']) + { + this.backgroundColor = config['backgroundColor']; + } + +} + +/** +* Initialises the stage and adds the event listeners. +* @method Phaser.Stage#boot +* @private +*/ +Phaser.Stage.prototype.boot = function () { + + Phaser.Canvas.getOffset(this.game.canvas, this.offset); + + this.bounds = new Phaser.Rectangle(this.offset.x, this.offset.y, this.game.width, this.game.height); + + var _this = this; + + this._onChange = function (event) { + return _this.visibilityChange(event); + } + + Phaser.Canvas.setUserSelect(this.game.canvas, 'none'); + Phaser.Canvas.setTouchAction(this.game.canvas, 'none'); + + document.addEventListener('visibilitychange', this._onChange, false); + document.addEventListener('webkitvisibilitychange', this._onChange, false); + document.addEventListener('pagehide', this._onChange, false); + document.addEventListener('pageshow', this._onChange, false); + + window.onblur = this._onChange; + window.onfocus = this._onChange; + +} + +/** +* Runs Stage processes that need periodic updates, such as the offset checks. +* @method Phaser.Stage#update +*/ +Phaser.Stage.prototype.update = function () { + + if (this.checkOffsetInterval !== false) + { + if (this.game.time.now > this._nextOffsetCheck) + { + Phaser.Canvas.getOffset(this.game.canvas, this.offset); + this._nextOffsetCheck = this.game.time.now + this.checkOffsetInterval; + } + + } + +} + +/** +* This method is called when the document visibility is changed. +* @method Phaser.Stage#visibilityChange +* @param {Event} event - Its type will be used to decide whether the game should be paused or not. +*/ +Phaser.Stage.prototype.visibilityChange = function (event) { + + if (this.disableVisibilityChange) + { + return; + } + + if (this.game.paused === false && (event.type == 'pagehide' || event.type == 'blur' || document['hidden'] === true || document['webkitHidden'] === true)) + { + this.game.paused = true; + } + else + { + this.game.paused = false; + } + +} + +/** +* Sets the background color for the stage. +* +* @name Phaser.Stage#setBackgroundColor +* @param {number} backgroundColor - The color of the background, easiest way to pass this in is in hex format like: 0xFFFFFF for white. +*/ +Phaser.Stage.prototype.setBackgroundColor = function(backgroundColor) +{ + this._backgroundColor = backgroundColor || 0x000000; + this.backgroundColorSplit = PIXI.hex2rgb(this.backgroundColor); + var hex = this._backgroundColor.toString(16); + hex = '000000'.substr(0, 6 - hex.length) + hex; + this.backgroundColorString = '#' + hex; +} + /** * @name Phaser.Stage#backgroundColor * @property {number|string} backgroundColor - Gets and sets the background color of the stage. The color can be given as a number: 0xff0000 or a hex string: '#ff0000' @@ -704,7 +776,7 @@ Object.defineProperty(Phaser.Stage.prototype, "backgroundColor", { color = Phaser.Color.hexToRGB(color); } - this._stage.setBackgroundColor(color); + this.setBackgroundColor(color); } } @@ -731,7 +803,7 @@ Object.defineProperty(Phaser.Stage.prototype, "backgroundColor", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/StageScaleMode.js.html b/docs/StageScaleMode.js.html index dcb6582c..4b5cf9f5 100644 --- a/docs/StageScaleMode.js.html +++ b/docs/StageScaleMode.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -483,37 +491,24 @@ Phaser.StageScaleMode = function (game, width, height) { /** * @property {number} minWidth - Minimum width the canvas should be scaled to (in pixels). - * @default */ this.minWidth = null; /** - * @property {number} maxWidth - Maximum width the canvas should be scaled to (in pixels). - * If null it will scale to whatever width the browser can handle. - * @default + * @property {number} maxWidth - Maximum width the canvas should be scaled to (in pixels). If null it will scale to whatever width the browser can handle. */ this.maxWidth = null; /** * @property {number} minHeight - Minimum height the canvas should be scaled to (in pixels). - * @default */ this.minHeight = null; /** - * @property {number} maxHeight - Maximum height the canvas should be scaled to (in pixels). - * If null it will scale to whatever height the browser can handle. - * @default + * @property {number} maxHeight - Maximum height the canvas should be scaled to (in pixels). If null it will scale to whatever height the browser can handle. */ this.maxHeight = null; - /** - * @property {number} _startHeight - Stage height when starting the game. - * @default - * @private - */ - this._startHeight = 0; - /** * @property {boolean} forceLandscape - If the game should be forced to use Landscape mode, this is set to true by Game.Stage * @default @@ -548,20 +543,6 @@ Phaser.StageScaleMode = function (game, width, height) { */ this.pageAlignVertically = false; - /** - * @property {number} _width - Cached stage width for full screen mode. - * @default - * @private - */ - this._width = 0; - - /** - * @property {number} _height - Cached stage height for full screen mode. - * @default - * @private - */ - this._height = 0; - /** * @property {number} maxIterations - The maximum number of times it will try to resize the canvas to fill the browser. * @default @@ -570,7 +551,6 @@ Phaser.StageScaleMode = function (game, width, height) { /** * @property {PIXI.Sprite} orientationSprite - The Sprite that is optionally displayed if the browser enters an unsupported orientation. - * @default */ this.orientationSprite = null; @@ -599,6 +579,11 @@ Phaser.StageScaleMode = function (game, width, height) { */ this.hasResized = new Phaser.Signal(); + /** + * @property {number} orientation - The orientation value of the game (as defined by window.orientation if set). 90 = landscape. 0 = portrait. + */ + this.orientation = 0; + if (window['orientation']) { this.orientation = window['orientation']; @@ -609,10 +594,6 @@ Phaser.StageScaleMode = function (game, width, height) { { this.orientation = 90; } - else - { - this.orientation = 0; - } } /** @@ -634,16 +615,50 @@ Phaser.StageScaleMode = function (game, width, height) { this.margin = new Phaser.Point(0, 0); /** - * @property {number} aspectRatio - Aspect ratio. - * @default + * @property {number} aspectRatio - The aspect ratio of the scaled game. + * @readonly */ this.aspectRatio = 0; + /** + * @property {number} sourceAspectRatio - The aspect ratio (width / height) of the original game dimensions. + * @readonly + */ + this.sourceAspectRatio = width / height; + /** * @property {any} event- The native browser events from full screen API changes. */ this.event = null; + /** + * @property {number} scaleMode - The current scaleMode. + */ + this.scaleMode = Phaser.StageScaleMode.NO_SCALE; + + /* + * @property {number} fullScreenScaleMode - Scale mode to be used in fullScreen + */ + this.fullScreenScaleMode = Phaser.StageScaleMode.NO_SCALE; + + /** + * @property {number} _startHeight - Internal cache var. Stage height when starting the game. + * @private + */ + this._startHeight = 0; + + /** + * @property {number} _width - Cached stage width for full screen mode. + * @private + */ + this._width = 0; + + /** + * @property {number} _height - Cached stage height for full screen mode. + * @private + */ + this._height = 0; + var _this = this; window.addEventListener('orientationchange', function (event) { @@ -762,10 +777,10 @@ Phaser.StageScaleMode.prototype = { if (this.isFullScreen) { - if (this.game.stage.fullScreenScaleMode === Phaser.StageScaleMode.EXACT_FIT) + if (this.fullScreenScaleMode === Phaser.StageScaleMode.EXACT_FIT) { - this.game.stage.canvas.style['width'] = '100%'; - this.game.stage.canvas.style['height'] = '100%'; + this.game.canvas.style['width'] = '100%'; + this.game.canvas.style['height'] = '100%'; this.setMaximum(); @@ -775,16 +790,16 @@ Phaser.StageScaleMode.prototype = { this.scaleFactor.x = this.game.width / this.width; this.scaleFactor.y = this.game.height / this.height; } - else if (this.game.stage.fullScreenScaleMode === Phaser.StageScaleMode.SHOW_ALL) + else if (this.fullScreenScaleMode === Phaser.StageScaleMode.SHOW_ALL) { - this.game.stage.scale.setShowAll(); - this.game.stage.scale.refresh(); + this.setShowAll(); + this.refresh(); } } else { - this.game.stage.canvas.style['width'] = this.game.width + 'px'; - this.game.stage.canvas.style['height'] = this.game.height + 'px'; + this.game.canvas.style['width'] = this.game.width + 'px'; + this.game.canvas.style['height'] = this.game.height + 'px'; this.width = this._width; this.height = this._height; @@ -839,7 +854,7 @@ Phaser.StageScaleMode.prototype = { this.game.world.visible = true; } - this.game.stage._stage.addChild(this.orientationSprite); + this.game.stage.addChild(this.orientationSprite); } }, @@ -909,7 +924,7 @@ Phaser.StageScaleMode.prototype = { this.enterPortrait.dispatch(this.orientation, false, true); } - if (this.game.stage.scaleMode !== Phaser.StageScaleMode.NO_SCALE) + if (this.scaleMode !== Phaser.StageScaleMode.NO_SCALE) { this.refresh(); } @@ -943,7 +958,7 @@ Phaser.StageScaleMode.prototype = { this.enterPortrait.dispatch(this.orientation, false, true); } - if (this.game.stage.scaleMode !== Phaser.StageScaleMode.NO_SCALE) + if (this.scaleMode !== Phaser.StageScaleMode.NO_SCALE) { this.refresh(); } @@ -1022,22 +1037,22 @@ Phaser.StageScaleMode.prototype = { } else if (!this.isFullScreen) { - if (this.game.stage.scaleMode == Phaser.StageScaleMode.EXACT_FIT) + if (this.scaleMode == Phaser.StageScaleMode.EXACT_FIT) { this.setExactFit(); } - else if (this.game.stage.scaleMode == Phaser.StageScaleMode.SHOW_ALL) + else if (this.scaleMode == Phaser.StageScaleMode.SHOW_ALL) { this.setShowAll(); } } else { - if (this.game.stage.fullScreenScaleMode == Phaser.StageScaleMode.EXACT_FIT) + if (this.fullScreenScaleMode == Phaser.StageScaleMode.EXACT_FIT) { this.setExactFit(); } - else if (this.game.stage.fullScreenScaleMode == Phaser.StageScaleMode.SHOW_ALL) + else if (this.fullScreenScaleMode == Phaser.StageScaleMode.SHOW_ALL) { this.setShowAll(); } @@ -1246,7 +1261,7 @@ Object.defineProperty(Phaser.StageScaleMode.prototype, "isLandscape", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/State.js.html b/docs/State.js.html index de4968e5..0c38ab53 100644 --- a/docs/State.js.html +++ b/docs/State.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -641,7 +649,7 @@ Phaser.State.prototype.constructor = Phaser.State; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/StateManager.js.html b/docs/StateManager.js.html index 9cba01a8..3c6f324c 100644 --- a/docs/StateManager.js.html +++ b/docs/StateManager.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -654,11 +662,12 @@ Phaser.StateManager.prototype = { }, /** - * Start the given state + * Start the given State. If a State is already running then State.shutDown will be called (if it exists) before switching to the new State. + * * @method Phaser.StateManager#start * @param {string} key - The key of the state you want to start. - * @param {boolean} [clearWorld] - clear everything in the world? (Default to true) - * @param {boolean} [clearCache] - clear asset cache? (Default to false and ONLY available when clearWorld=true) + * @param {boolean} [clearWorld=true] - Clear everything in the world? This clears the World display list fully (but not the Stage, so if you've added your own objects to the Stage they will need managing directly) + * @param {boolean} [clearCache=false] - Clear the Game.Cache? This purges out all loaded assets. The default is false and you must have clearWorld=true if you want to clearCache as well. */ start: function (key, clearWorld, clearCache) { @@ -731,7 +740,7 @@ Phaser.StateManager.prototype = { }, /** - * Checks i a given phaser state is valid. + * Checks if a given phaser state is valid. * State must exist and have at least one callback function registered.. * @method Phaser.StateManager#checkState * @param {string} key - The key of the state you want to check. @@ -785,6 +794,7 @@ Phaser.StateManager.prototype = { this.states[key].load = this.game.load; this.states[key].math = this.game.math; this.states[key].sound = this.game.sound; + this.states[key].scale = this.game.scale; this.states[key].stage = this.game.stage; this.states[key].time = this.game.time; this.states[key].tweens = this.game.tweens; @@ -998,7 +1008,7 @@ Phaser.StateManager.prototype.constructor = Phaser.StateManager; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Text.js.html b/docs/Text.js.html index 589d77e6..286b4f14 100644 --- a/docs/Text.js.html +++ b/docs/Text.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -483,17 +491,6 @@ Phaser.Text = function (game, x, y, text, style) { */ this.exists = true; - /** - * @property {boolean} alive - This is a handy little var your game can use to determine if an object is alive or not, it doesn't effect rendering. - * @default - */ - this.alive = true; - - /** - * @property {Phaser.Group} group - The parent Group of this Text object. - */ - this.group = null; - /** * @property {string} name - The user defined name given to this object. * @default @@ -507,86 +504,73 @@ Phaser.Text = function (game, x, y, text, style) { this.type = Phaser.TEXT; /** - * @property {string} _text - Internal value. + * @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); + + /** + * @property {string} _text - Internal cache var. * @private */ this._text = text; /** - * @property {string} _style - Internal value. + * @property {string} _font - Internal cache var. * @private */ - this._style = style; + this._font = ''; + + /** + * @property {number} _fontSize - Internal cache var. + * @private + */ + this._fontSize = 32; + + /** + * @property {string} _fontWeight - Internal cache var. + * @private + */ + this._fontWeight = 'normal'; + + /** + * @property {number} lineSpacing - Additional spacing (in pixels) between each line of text if multi-line. + * @private + */ + this._lineSpacing = 0; + + /** + * @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 {Phaser.InputHandler|null} input - The Input Handler for this object. Needs to be enabled with image.inputEnabled = true before you can use it. + */ + this.input = null; + + /** + * @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view. + */ + this.cameraOffset = new Phaser.Point(); PIXI.Text.call(this, text, style); - /** - * @property {Phaser.Point} position - The position of this Text object in world space. - */ - this.position.x = this.x = x; - this.position.y = this.y = y; + this.position.set(x, y); /** - * 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(); - - /** - * @property {Phaser.Point} scale - The scale of the object 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. - */ - this.scale = new Phaser.Point(1, 1); - - /** - * An object that is fixed to the camera ignores the position of any ancestors in the display list and uses its x/y coordinates as offsets from the top left of the camera. - * @property {boolean} fixedToCamera - Fixes this object to the Camera. - * @default - */ - this.fixedToCamera = false; - - /** - * @property {Phaser.Point} cameraOffset - If this object is fixed to the camera then use this Point to specify how far away from the Camera x/y it's rendered. - */ - this.cameraOffset = new Phaser.Point(x, y); - - /** - * @property {object} _cache - A mini cache for storing all of the calculated values. + * A small internal cache: + * 0 = previous position.x + * 1 = previous position.y + * 2 = previous rotation + * 3 = renderID + * 4 = fresh? (0 = no, 1 = yes) + * 5 = outOfBoundsFired (0 = no, 1 = yes) + * 6 = exists (0 = no, 1 = yes) + * 7 = fixed to camera (0 = no, 1 = yes) + * @property {Int16Array} _cache * @private */ - this._cache = { - - dirty: false, - - // Transform cache - a00: 1, - a01: 0, - a02: x, - a10: 0, - a11: 1, - a12: y, - id: 1, - - // The previous calculated position - x: -1, - y: -1, - - // The actual scale values based on the worldTransform - scaleX: 1, - scaleY: 1 - - }; - - this._cache.x = this.x; - this._cache.y = this.y; - - /** - * @property {boolean} renderable - A renderable object will be rendered to the context each frame. - */ - this.renderable = true; + this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0]); }; @@ -594,32 +578,59 @@ Phaser.Text.prototype = Object.create(PIXI.Text.prototype); Phaser.Text.prototype.constructor = Phaser.Text; /** -* Automatically called by World.update. -* @method Phaser.Text.prototype.update +* Automatically called by World.preUpdate. +* @method Phaser.Text.prototype.preUpdate +*/ +Phaser.Text.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; + +} + +/** +* Override and use this function in your own custom objects to handle any update requirements you may have. +* +* @method Phaser.Text#update +* @memberof Phaser.Text */ Phaser.Text.prototype.update = function() { - if (!this.exists) +} + +/** +* Automatically called by World.postUpdate. +* @method Phaser.Text.prototype.postUpdate +*/ +Phaser.Text.prototype.postUpdate = function () { + + // Fixed to Camera? + if (this._cache[7] === 1) { - return; - } - - if (this.fixedToCamera) - { - this.x = this.game.camera.view.x + this.cameraOffset.x; - this.y = this.game.camera.view.y + this.cameraOffset.y; - } - - this._cache.dirty = false; - - this._cache.x = this.x; - this._cache.y = this.y; - - if (this.position.x != this._cache.x || this.position.y != this._cache.y) - { - this.position.x = this._cache.x; - this.position.y = this._cache.y; - this._cache.dirty = true; + this.position.x = this.game.camera.view.x + this.cameraOffset.x; + this.position.y = this.game.camera.view.y + this.cameraOffset.y; } } @@ -627,13 +638,20 @@ Phaser.Text.prototype.update = function() { /** * @method Phaser.Text.prototype.destroy */ -Phaser.Text.prototype.destroy = function() { +Phaser.Text.prototype.destroy = function () { - if (this.group) + if (this.filters) { - this.group.remove(this); + this.filters = null; } + if (this.parent) + { + this.parent.remove(this); + } + + this.texture.destroy(); + if (this.canvas.parentNode) { this.canvas.parentNode.removeChild(this.canvas); @@ -645,8 +663,187 @@ Phaser.Text.prototype.destroy = function() { } this.exists = false; + this.visible = false; - this.group = null; + this.game = null; + +} + +/** +* @method Phaser.Text.prototype.setShadow +* @param {number} [x=0] - The shadowOffsetX value in pixels. This is how far offset horizontally the shadow effect will be. +* @param {number} [y=0] - The shadowOffsetY value in pixels. This is how far offset vertically the shadow effect will be. +* @param {string} [color='rgba(0,0,0,0)'] - The color of the shadow, as given in CSS rgba format. Set the alpha component to 0 to disable the shadow. +* @param {number} [blur=0] - The shadowBlur value. Make the shadow softer by applying a Gaussian blur to it. A number from 0 (no blur) up to approx. 10 (depending on scene). +*/ +Phaser.Text.prototype.setShadow = function (x, y, color, blur) { + + this.style.shadowOffsetX = x || 0; + this.style.shadowOffsetY = y || 0; + this.style.shadowColor = color || 'rgba(0,0,0,0)'; + this.style.shadowBlur = blur || 0; + this.dirty = true; + +} + +/** +* Set the style of the text by passing a single style object to it. +* +* @method Phaser.Text.prototype.setStyle +* @param [style] {Object} The style parameters +* @param [style.font='bold 20pt Arial'] {String} The style and size of the font +* @param [style.fill='black'] {Object} A canvas fillstyle that will be used on the text eg 'red', '#00FF00' +* @param [style.align='left'] {String} Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text +* @param [style.stroke='black'] {String} A canvas fillstyle that will be used on the text stroke eg 'blue', '#FCFF00' +* @param [style.strokeThickness=0] {Number} A number that represents the thickness of the stroke. Default is 0 (no stroke) +* @param [style.wordWrap=false] {Boolean} Indicates if word wrap should be used +* @param [style.wordWrapWidth=100] {Number} The width at which text will wrap +*/ +Phaser.Text.prototype.setStyle = function (style) { + + style = style || {}; + style.font = style.font || 'bold 20pt Arial'; + style.fill = style.fill || 'black'; + style.align = style.align || 'left'; + style.stroke = style.stroke || 'black'; //provide a default, see: https://github.com/GoodBoyDigital/pixi.js/issues/136 + style.strokeThickness = style.strokeThickness || 0; + style.wordWrap = style.wordWrap || false; + style.wordWrapWidth = style.wordWrapWidth || 100; + style.shadowOffsetX = style.shadowOffsetX || 0; + style.shadowOffsetY = style.shadowOffsetY || 0; + style.shadowColor = style.shadowColor || 'rgba(0,0,0,0)'; + style.shadowBlur = style.shadowBlur || 0; + + this.style = style; + this.dirty = true; + +} + +/** +* Renders text. This replaces the Pixi.Text.updateText function as we need a few extra bits in here. +* +* @method Phaser.Text.prototype.updateText +* @private +*/ +Phaser.Text.prototype.updateText = function () { + + this.context.font = this.style.font; + + var outputText = this.text; + + // word wrap + // preserve original text + if(this.style.wordWrap)outputText = this.runWordWrap(this.text); + + //split text into lines + var lines = outputText.split(/(?:\r\n|\r|\n)/); + + //calculate text width + var lineWidths = []; + var maxLineWidth = 0; + for (var i = 0; i < lines.length; i++) + { + var lineWidth = this.context.measureText(lines[i]).width; + lineWidths[i] = lineWidth; + maxLineWidth = Math.max(maxLineWidth, lineWidth); + } + this.canvas.width = maxLineWidth + this.style.strokeThickness; + + //calculate text height + var lineHeight = this.determineFontHeight('font: ' + this.style.font + ';') + this.style.strokeThickness + this._lineSpacing + this.style.shadowOffsetY; + this.canvas.height = lineHeight * lines.length; + + if(navigator.isCocoonJS) this.context.clearRect(0,0,this.canvas.width,this.canvas.height); + + //set canvas text styles + this.context.fillStyle = this.style.fill; + this.context.font = this.style.font; + + this.context.strokeStyle = this.style.stroke; + this.context.lineWidth = this.style.strokeThickness; + + this.context.shadowOffsetX = this.style.shadowOffsetX; + this.context.shadowOffsetY = this.style.shadowOffsetY; + this.context.shadowColor = this.style.shadowColor; + this.context.shadowBlur = this.style.shadowBlur; + + this.context.textBaseline = 'top'; + + //draw lines line by line + for (i = 0; i < lines.length; i++) + { + var linePosition = new PIXI.Point(this.style.strokeThickness / 2, this.style.strokeThickness / 2 + i * lineHeight); + + if(this.style.align === 'right') + { + linePosition.x += maxLineWidth - lineWidths[i]; + } + else if(this.style.align === 'center') + { + linePosition.x += (maxLineWidth - lineWidths[i]) / 2; + } + + linePosition.y += this._lineSpacing; + + if(this.style.stroke && this.style.strokeThickness) + { + this.context.strokeText(lines[i], linePosition.x, linePosition.y); + } + + if(this.style.fill) + { + this.context.fillText(lines[i], linePosition.x, linePosition.y); + } + } + + this.updateTexture(); +} + +/** +* Greedy wrapping algorithm that will wrap words as the line grows longer than its horizontal bounds. +* +* @method Phaser.Text.prototype.runWordWrap +* @private +*/ +Phaser.Text.prototype.runWordWrap = function (text) { + + var result = ''; + var lines = text.split('\n'); + + for (var i = 0; i < lines.length; i++) + { + var spaceLeft = this.style.wordWrapWidth; + var words = lines[i].split(' '); + + for (var j = 0; j < words.length; j++) + { + var wordWidth = this.context.measureText(words[j]).width; + var wordWidthWithSpace = wordWidth + this.context.measureText(' ').width; + + if (wordWidthWithSpace > spaceLeft) + { + // Skip printing the newline if it's the first word of the line that is greater than the word wrap width. + if (j > 0) + { + result += '\n'; + } + result += words[j] + ' '; + spaceLeft = this.style.wordWrapWidth - wordWidth; + } + else + { + spaceLeft -= wordWidthWithSpace; + result += words[j] + ' '; + } + } + + if (i < lines.length-1) + { + result += '\n'; + } + } + + return result; } @@ -670,45 +867,11 @@ Object.defineProperty(Phaser.Text.prototype, 'angle', { }); /** -* The x coordinate of this object in world space. -* @name Phaser.Text#x -* @property {number} x - The x coordinate of this object in world space. +* The text string to be displayed by this Text object, taking into account the style settings. +* @name Phaser.Text#text +* @property {string} text - The text string to be displayed by this Text object, taking into account the style settings. */ -Object.defineProperty(Phaser.Text.prototype, 'x', { - - get: function() { - return this.position.x; - }, - - set: function(value) { - this.position.x = value; - } - -}); - -/** -* The y coordinate of this object in world space. -* @name Phaser.Text#y -* @property {number} y - The y coordinate of this object in world space. -*/ -Object.defineProperty(Phaser.Text.prototype, 'y', { - - get: function() { - return this.position.y; - }, - - set: function(value) { - this.position.y = value; - } - -}); - -/** -* The string to be rendered by this Text object. -* @name Phaser.Text#content -* @property {string} content - The string to be rendered by this Text object. -*/ -Object.defineProperty(Phaser.Text.prototype, 'content', { +Object.defineProperty(Phaser.Text.prototype, 'text', { get: function() { return this._text; @@ -716,11 +879,10 @@ Object.defineProperty(Phaser.Text.prototype, 'content', { set: function(value) { - // Let's not update unless needed, this way we can safely update the text in a core loop without constant re-draws if (value !== this._text) { - this._text = value; - this.setText(value); + this._text = value.toString() || ' '; + this.dirty = true; } } @@ -728,27 +890,383 @@ Object.defineProperty(Phaser.Text.prototype, 'content', { }); /** -* The font the text will be rendered in. * @name Phaser.Text#font -* @property {string} font - The font the text will be rendered in. +* @property {string} font - The font the text will be rendered in, i.e. 'Arial'. Must be loaded in the browser before use. */ Object.defineProperty(Phaser.Text.prototype, 'font', { get: function() { - return this._style; + return this._font; }, set: function(value) { - // Let's not update unless needed, this way we can safely update the text in a core loop without constant re-draws - if (value !== this._style) + if (value !== this._font) { - this._style = value; - this.setStyle(value); + this._font = value.trim(); + this.style.font = this._fontWeight + ' ' + this._fontSize + "px '" + this._font + "'"; + this.dirty = true; } } +}); + +/** +* @name Phaser.Text#fontSize +* @property {number} fontSize - The size of the font in pixels. +*/ +Object.defineProperty(Phaser.Text.prototype, 'fontSize', { + + get: function() { + return this._fontSize; + }, + + set: function(value) { + + value = parseInt(value); + + if (value !== this._fontSize) + { + this._fontSize = value; + this.style.font = this._fontWeight + ' ' + this._fontSize + "px '" + this._font + "'"; + this.dirty = true; + } + + } + +}); + +/** +* @name Phaser.Text#fontWeight +* @property {number} fontWeight - The weight of the font: 'normal', 'bold', 'italic'. You can combine settings too, such as 'bold italic'. +*/ +Object.defineProperty(Phaser.Text.prototype, 'fontWeight', { + + get: function() { + return this._fontWeight; + }, + + set: function(value) { + + if (value !== this._fontWeight) + { + this._fontWeight = value; + this.style.font = this._fontWeight + ' ' + this._fontSize + "px '" + this._font + "'"; + this.dirty = true; + } + + } + +}); + +/** +* @name Phaser.Text#fill +* @property {object} fill - A canvas fillstyle that will be used on the text eg 'red', '#00FF00'. +*/ +Object.defineProperty(Phaser.Text.prototype, 'fill', { + + get: function() { + return this.style.fill; + }, + + set: function(value) { + + if (value !== this.style.fill) + { + this.style.fill = value; + this.dirty = true; + } + + } + +}); + +/** +* @name Phaser.Text#align +* @property {string} align - Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text. +*/ +Object.defineProperty(Phaser.Text.prototype, 'align', { + + get: function() { + return this.style.align; + }, + + set: function(value) { + + if (value !== this.style.align) + { + this.style.align = value; + this.dirty = true; + } + + } + +}); + +/** +* @name Phaser.Text#stroke +* @property {string} stroke - A canvas fillstyle that will be used on the text stroke eg 'blue', '#FCFF00'. +*/ +Object.defineProperty(Phaser.Text.prototype, 'stroke', { + + get: function() { + return this.style.stroke; + }, + + set: function(value) { + + if (value !== this.style.stroke) + { + this.style.stroke = value; + this.dirty = true; + } + + } + +}); + +/** +* @name Phaser.Text#strokeThickness +* @property {number} strokeThickness - A number that represents the thickness of the stroke. Default is 0 (no stroke) +*/ +Object.defineProperty(Phaser.Text.prototype, 'strokeThickness', { + + get: function() { + return this.style.strokeThickness; + }, + + set: function(value) { + + if (value !== this.style.strokeThickness) + { + this.style.strokeThickness = value; + this.dirty = true; + } + + } + +}); + +/** +* @name Phaser.Text#wordWrap +* @property {boolean} wordWrap - Indicates if word wrap should be used. +*/ +Object.defineProperty(Phaser.Text.prototype, 'wordWrap', { + + get: function() { + return this.style.wordWrap; + }, + + set: function(value) { + + if (value !== this.style.wordWrap) + { + this.style.wordWrap = value; + this.dirty = true; + } + + } + +}); + +/** +* @name Phaser.Text#wordWrapWidth +* @property {number} wordWrapWidth - The width at which text will wrap. +*/ +Object.defineProperty(Phaser.Text.prototype, 'wordWrapWidth', { + + get: function() { + return this.style.wordWrapWidth; + }, + + set: function(value) { + + if (value !== this.style.wordWrapWidth) + { + this.style.wordWrapWidth = value; + this.dirty = true; + } + + } + +}); + +/** +* @name Phaser.Text#lineSpacing +* @property {number} lineSpacing - Additional spacing (in pixels) between each line of text if multi-line. +*/ +Object.defineProperty(Phaser.Text.prototype, 'lineSpacing', { + + get: function() { + return this._lineSpacing; + }, + + set: function(value) { + + if (value !== this._lineSpacing) + { + this._lineSpacing = parseFloat(value); + this.dirty = true; + } + + } + +}); + +/** +* @name Phaser.Text#shadowOffsetX +* @property {number} shadowOffsetX - The shadowOffsetX value in pixels. This is how far offset horizontally the shadow effect will be. +*/ +Object.defineProperty(Phaser.Text.prototype, 'shadowOffsetX', { + + get: function() { + return this.style.shadowOffsetX; + }, + + set: function(value) { + + if (value !== this.style.shadowOffsetX) + { + this.style.shadowOffsetX = value; + this.dirty = true; + } + + } + +}); + +/** +* @name Phaser.Text#shadowOffsetY +* @property {number} shadowOffsetY - The shadowOffsetY value in pixels. This is how far offset vertically the shadow effect will be. +*/ +Object.defineProperty(Phaser.Text.prototype, 'shadowOffsetY', { + + get: function() { + return this.style.shadowOffsetY; + }, + + set: function(value) { + + if (value !== this.style.shadowOffsetY) + { + this.style.shadowOffsetY = value; + this.dirty = true; + } + + } + +}); + +/** +* @name Phaser.Text#shadowColor +* @property {string} shadowColor - The color of the shadow, as given in CSS rgba format. Set the alpha component to 0 to disable the shadow. +*/ +Object.defineProperty(Phaser.Text.prototype, 'shadowColor', { + + get: function() { + return this.style.shadowColor; + }, + + set: function(value) { + + if (value !== this.style.shadowColor) + { + this.style.shadowColor = value; + this.dirty = true; + } + + } + +}); + +/** +* @name Phaser.Text#shadowBlur +* @property {number} shadowBlur - The shadowBlur value. Make the shadow softer by applying a Gaussian blur to it. A number from 0 (no blur) up to approx. 10 (depending on scene). +*/ +Object.defineProperty(Phaser.Text.prototype, 'shadowBlur', { + + get: function() { + return this.style.shadowBlur; + }, + + set: function(value) { + + if (value !== this.style.shadowBlur) + { + this.style.shadowBlur = value; + this.dirty = true; + } + + } + +}); + +/** +* By default a Text object 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.Text#inputEnabled +* @property {boolean} inputEnabled - Set to true to allow this object to receive input events. +*/ +Object.defineProperty(Phaser.Text.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(); + } + } + } + +}); + +/** +* An Text that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in Text.cameraOffset. +* Note that the cameraOffset values are in addition to any parent in the display list. +* So if this Text was in a Group that has x: 200, then this will be added to the cameraOffset.x +* +* @name Phaser.Text#fixedToCamera +* @property {boolean} fixedToCamera - Set to true to fix this Text to the Camera at its current world coordinates. +*/ +Object.defineProperty(Phaser.Text.prototype, "fixedToCamera", { + + get: function () { + + return !!this._cache[7]; + + }, + + set: function (value) { + + if (value) + { + this._cache[7] = 1; + this.cameraOffset.set(this.x, this.y); + } + else + { + this._cache[7] = 0; + } + } + }); @@ -771,7 +1289,7 @@ Object.defineProperty(Phaser.Text.prototype, 'font', { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Tile.js.html b/docs/Tile.js.html index 57038134..02d2c187 100644 --- a/docs/Tile.js.html +++ b/docs/Tile.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -571,16 +579,16 @@ Phaser.Tile = function (layer, index, x, y, width, height) { this.collideDown = false; /** - * @property {function} callback - Tile collision callback. + * @property {function} collisionCallback - Tile collision callback. * @default */ - this.callback = null; + this.collisionCallback = null; /** - * @property {object} callbackContext - The context in which the collision callback will be called. + * @property {object} collisionCallbackContext - The context in which the collision callback will be called. * @default */ - this.callbackContext = this; + this.collisionCallbackContext = this; }; @@ -592,12 +600,12 @@ Phaser.Tile.prototype = { * * @method Phaser.Tile#setCollisionCallback * @param {function} callback - Callback function. - * @param {object} context - Callback will be called with this context. + * @param {object} context - Callback will be called within this context. */ setCollisionCallback: function (callback, context) { - this.collisionCallbackContext = context; this.collisionCallback = callback; + this.collisionCallbackContext = context; }, @@ -763,7 +771,7 @@ Object.defineProperty(Phaser.Tile.prototype, "bottom", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/TileSprite.js.html b/docs/TileSprite.js.html index ea50c502..f8b4473b 100644 --- a/docs/TileSprite.js.html +++ b/docs/TileSprite.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -456,33 +464,38 @@ */ /** -* A TileSprite is a Sprite whos texture is set to repeat and can be scrolled. As it scrolls the texture repeats (wraps) on the edges. -* @class Phaser.Tilemap -* @extends Phaser.Sprite +* A TileSprite is a Sprite that has a repeating texture. The texture can be scrolled and scaled and will automatically wrap on the edges as it does so. +* Please note that TileSprites have no input handler or physics bodies. +* +* @class Phaser.TileSprite * @constructor -* @param {Phaser.Game} game - Current game instance. -* @param {number} x - X position of the new tileSprite. -* @param {number} y - Y position of the new tileSprite. -* @param {number} width - the width of the tilesprite. -* @param {number} height - the height of the tilesprite. -* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture. +* @param {Phaser.Game} game - A reference to the currently running game. +* @param {number} x - The x coordinate (in world space) to position the TileSprite at. +* @param {number} y - The y coordinate (in world space) to position the TileSprite at. +* @param {number} width - The width of the TileSprite. +* @param {number} height - The height of the TileSprite. +* @param {string|Phaser.RenderTexture|Phaser.BitmapData|PIXI.Texture} key - This is the image or texture used by the TileSprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture. +* @param {string|number} frame - If this TileSprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index. */ -Phaser.TileSprite = function (game, x, y, width, height, key) { +Phaser.TileSprite = function (game, x, y, width, height, key, frame) { x = x || 0; y = y || 0; width = width || 256; height = height || 256; key = key || null; - - Phaser.Sprite.call(this, game, x, y, key); + frame = frame || null; /** - * @property {PIXI.Texture} texture - The texture that the sprite renders with. + * @property {Phaser.Game} game - A reference to the currently running Game. */ - this.texture = PIXI.TextureCache[key]; + this.game = game; - PIXI.TilingSprite.call(this, this.texture, width, height); + /** + * @property {string} name - The user defined name given to this Sprite. + * @default + */ + this.name = ''; /** * @property {number} type - The const type of this object. @@ -491,38 +504,294 @@ Phaser.TileSprite = function (game, x, y, width, height, key) { this.type = Phaser.TILESPRITE; /** - * @property {Phaser.Point} tileScale - The scaling of the image that is being tiled. + * @property {Phaser.Events} events - The Events you can subscribe to that are dispatched when certain things happen on this Sprite or its components. */ - this.tileScale = new Phaser.Point(1, 1); + this.events = new Phaser.Events(this); /** - * @property {Phaser.Point} tilePosition - The offset position of the image that is being tiled. + * @property {Phaser.AnimationManager} animations - This manages animations of the sprite. You can modify animations through it (see Phaser.AnimationManager) */ - this.tilePosition = new Phaser.Point(0, 0); + this.animations = new Phaser.AnimationManager(this); - this.body.width = width; - this.body.height = height; + /** + * @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 {number} _frame - Internal cache var. + * @private + */ + this._frame = 0; + + /** + * @property {string} _frameName - Internal cache var. + * @private + */ + this._frameName = ''; + + /** + * @property {Phaser.Point} _scroll - Internal cache var. + * @private + */ + this._scroll = new Phaser.Point(); + + PIXI.TilingSprite.call(this, PIXI.TextureCache['__default'], width, height); + + 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); + + /** + * @property {Phaser.Point} cameraOffset - If this object is fixedToCamera then this stores the x/y offset that its drawn at, from the top-left of the camera view. + */ + this.cameraOffset = new Phaser.Point(); + + /** + * A small internal cache: + * 0 = previous position.x + * 1 = previous position.y + * 2 = previous rotation + * 3 = renderID + * 4 = fresh? (0 = no, 1 = yes) + * 5 = outOfBoundsFired (0 = no, 1 = yes) + * 6 = exists (0 = no, 1 = yes) + * 7 = fixed to camera (0 = no, 1 = yes) + * @property {Int16Array} _cache + * @private + */ + this._cache = new Int16Array([0, 0, 0, 0, 1, 0, 1, 0]); }; -Phaser.TileSprite.prototype = Phaser.Utils.extend(true, PIXI.TilingSprite.prototype, Phaser.Sprite.prototype); +Phaser.TileSprite.prototype = Object.create(PIXI.TilingSprite.prototype); Phaser.TileSprite.prototype.constructor = Phaser.TileSprite; +/** +* Automatically called by World.preUpdate. +* +* @method Phaser.TileSprite#preUpdate +* @memberof Phaser.TileSprite +*/ +Phaser.TileSprite.prototype.preUpdate = function() { + + this.world.setTo(this.game.camera.x + this.worldTransform[2], this.game.camera.y + this.worldTransform[5]); + + this.animations.update(); + + if (this._scroll.x !== 0) + { + this.tilePosition.x += this._scroll.x * this.game.time.physicsElapsed; + } + + if (this._scroll.y !== 0) + { + this.tilePosition.y += this._scroll.y * this.game.time.physicsElapsed; + } + + return true; + +} + +/** +* Override and use this function in your own custom objects to handle any update requirements you may have. +* +* @method Phaser.TileSprite#update +* @memberof Phaser.TileSprite +*/ +Phaser.TileSprite.prototype.update = function() { + +} + +/** +* Internal function called by the World postUpdate cycle. +* +* @method Phaser.TileSprite#postUpdate +* @memberof Phaser.TileSprite +*/ +Phaser.TileSprite.prototype.postUpdate = function() { + + // Fixed to Camera? + if (this._cache[7] === 1) + { + this.position.x = this.game.camera.view.x + this.cameraOffset.x; + this.position.y = this.game.camera.view.y + this.cameraOffset.y; + } + +} + +/** +* Sets this TileSprite to automatically scroll in the given direction until stopped via TileSprite.stopScroll(). +* The scroll speed is specified in pixels per second. +* A negative x value will scroll to the left. A positive x value will scroll to the right. +* A negative y value will scroll up. A positive y value will scroll down. +* +* @method Phaser.TileSprite#autoScroll +* @memberof Phaser.TileSprite +*/ +Phaser.TileSprite.prototype.autoScroll = function(x, y) { + + this._scroll.set(x, y); + +} + +/** +* Stops an automatically scrolling TileSprite. +* +* @method Phaser.TileSprite#stopScroll +* @memberof Phaser.TileSprite +*/ +Phaser.TileSprite.prototype.stopScroll = function() { + + this._scroll.set(0, 0); + +} + +/** +* Changes the Texture the TileSprite 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.TileSprite#loadTexture +* @memberof Phaser.TileSprite +* @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.TileSprite.prototype.loadTexture = function (key, frame) { + + frame = frame || 0; + + if (key instanceof Phaser.RenderTexture) + { + this.key = key.key; + this.setTexture(key); + return; + } + else if (key instanceof Phaser.BitmapData) + { + this.key = key.key; + this.setTexture(key.texture); + return; + } + else if (key instanceof PIXI.Texture) + { + this.key = key; + this.setTexture(key); + return; + } + else + { + if (key === null || typeof key === 'undefined') + { + this.key = '__default'; + this.setTexture(PIXI.TextureCache[this.key]); + return; + } + else if (typeof key === 'string' && !this.game.cache.checkImageKey(key)) + { + this.key = '__missing'; + this.setTexture(PIXI.TextureCache[this.key]); + return; + } + + 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 === 'string') + { + this.frameName = frame; + } + else + { + this.frame = frame; + } + } + else + { + this.key = key; + this.setTexture(PIXI.TextureCache[key]); + return; + } + } + +} + +/** +* Destroys the TileSprite. This removes it from its parent group, destroys the event and animation handlers if present +* and nulls its reference to game, freeing it up for garbage collection. +* +* @method Phaser.TileSprite#destroy +* @memberof Phaser.TileSprite +*/ +Phaser.TileSprite.prototype.destroy = function() { + + if (this.filters) + { + this.filters = null; + } + + if (this.parent) + { + this.parent.remove(this); + } + + this.animations.destroy(); + + this.events.destroy(); + + this.exists = false; + this.visible = false; + + this.game = null; + +} + +/** +* 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. +* +* @method Phaser.TileSprite#play +* @memberof Phaser.TileSprite +* @param {string} name - The name of the animation to be played, e.g. "fire", "walk", "jump". +* @param {number} [frameRate=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. +* @param {boolean} [loop=false] - Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used. +* @param {boolean} [killOnComplete=false] - If set to true when the animation completes (only happens if loop=false) the parent Sprite will be killed. +* @return {Phaser.Animation} A reference to playing Animation instance. +*/ +Phaser.TileSprite.prototype.play = function (name, frameRate, loop, killOnComplete) { + + return this.animations.play(name, frameRate, loop, killOnComplete); + +} + /** * 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. +* 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.TileSprite#angle -* @property {number} angle - Gets or sets the Sprites angle of rotation in degrees. +* @property {number} angle - The angle of this Sprite in degrees. */ -Object.defineProperty(Phaser.TileSprite.prototype, 'angle', { +Object.defineProperty(Phaser.TileSprite.prototype, "angle", { get: function() { + return Phaser.Math.wrapAngle(Phaser.Math.radToDeg(this.rotation)); + }, set: function(value) { + this.rotation = Phaser.Math.degToRad(Phaser.Math.wrapAngle(value)); + } }); @@ -532,13 +801,18 @@ Object.defineProperty(Phaser.TileSprite.prototype, 'angle', { * @property {number} frame - Gets or sets the current frame index and updates the Texture Cache for display. */ Object.defineProperty(Phaser.TileSprite.prototype, "frame", { - + get: function () { return this.animations.frame; }, set: function (value) { - this.animations.frame = value; + + if (value !== this.animations.frame) + { + this.animations.frame = value; + } + } }); @@ -548,42 +822,35 @@ Object.defineProperty(Phaser.TileSprite.prototype, "frame", { * @property {string} frameName - Gets or sets the current frame name and updates the Texture Cache for display. */ Object.defineProperty(Phaser.TileSprite.prototype, "frameName", { - + get: function () { return this.animations.frameName; }, set: function (value) { - this.animations.frameName = value; + + if (value !== this.animations.frameName) + { + this.animations.frameName = value; + } + } }); /** -* @name Phaser.TileSprite#inCamera -* @property {boolean} inCamera - Is this sprite visible to the camera or not? -* @readonly -*/ -Object.defineProperty(Phaser.TileSprite.prototype, "inCamera", { - - get: function () { - return this._cache.cameraVisible; - } - -}); - -/** -* By default a Sprite won't process any input events at all. By setting inputEnabled to true the Phaser.InputHandler is -* activated for this Sprite instance and it will then start to process click/touch events and more. +* An TileSprite that is fixed to the camera uses its x/y coordinates as offsets from the top left of the camera. These are stored in TileSprite.cameraOffset. +* Note that the cameraOffset values are in addition to any parent in the display list. +* So if this TileSprite was in a Group that has x: 200, then this will be added to the cameraOffset.x * -* @name Phaser.TileSprite#inputEnabled -* @property {boolean} inputEnabled - Set to true to allow this Sprite to receive input events, otherwise false. +* @name Phaser.TileSprite#fixedToCamera +* @property {boolean} fixedToCamera - Set to true to fix this TileSprite to the Camera at its current world coordinates. */ -Object.defineProperty(Phaser.TileSprite.prototype, "inputEnabled", { +Object.defineProperty(Phaser.TileSprite.prototype, "fixedToCamera", { get: function () { - return (this.input.enabled); + return !!this._cache[7]; }, @@ -591,19 +858,13 @@ Object.defineProperty(Phaser.TileSprite.prototype, "inputEnabled", { if (value) { - if (this.input.enabled === false) - { - this.input.start(); - } + this._cache[7] = 1; + this.cameraOffset.set(this.x, this.y); } else { - if (this.input.enabled) - { - this.input.stop(); - } + this._cache[7] = 0; } - } }); @@ -628,7 +889,7 @@ Object.defineProperty(Phaser.TileSprite.prototype, "inputEnabled", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Tilemap.js.html b/docs/Tilemap.js.html index d86b6e9c..4b5df171 100644 --- a/docs/Tilemap.js.html +++ b/docs/Tilemap.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -548,6 +556,11 @@ Phaser.Tilemap = function (game, key) { */ this.objects = data.objects; + /** + * @property {array} collision - An array of collision data (polylines, etc). + */ + this.collision = data.collision; + /** * @property {array} images - An array of Tiled Image Layers. */ @@ -734,6 +747,141 @@ Phaser.Tilemap.prototype = { }, + /** + * Clears all physics bodies from the world for the given layer. + * + * @method Phaser.Tilemap#clearPhysicsBodies + * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer. + */ + clearPhysicsBodies: function (layer) { + + layer = this.getLayer(layer); + + var i = this.layers[layer].bodies.length; + + while (i--) + { + this.layers[layer].bodies[i].destroy(); + } + + }, + + /** + * Goes through all tiles in the given layer and converts those set to collide into physics bodies in the world. + * Only call this *after* you have specified all of the tiles you wish to collide with calls like Tilemap.setCollisionBetween, etc. + * Every time you call this method it will destroy any previously created bodies and remove them from the world. + * Therefore understand it's an expensive operation and not to be done in a core game update loop. + * + * @method Phaser.Tilemap#generateCollisionData + * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer. + * @param {boolean} [addToWorld=true] - If true it will automatically add each body to the world, otherwise it's up to you to do so. + * @return {array} An array of the Phaser.Physics.Body objects that have been created. + */ + generateCollisionData: function (layer, addToWorld) { + + layer = this.getLayer(layer); + + if (typeof addToWorld === 'undefined') { addToWorld = true; } + + // If the bodies array is already populated we need to nuke it + if (this.layers[layer].bodies.length > 0) + { + this.clearPhysicsBodies(layer); + } + + this.layers[layer].bodies.length = []; + + var width = 0; + var sx = 0; + var sy = 0; + + for (var y = 0, h = this.layers[layer].height; y < h; y++) + { + width = 0; + + for (var x = 0, w = this.layers[layer].width; x < w; x++) + { + var tile = this.layers[layer].data[y][x]; + + if (tile) + { + right = this.getTileRight(layer, x, y); + + if (width === 0) + { + sx = tile.x * tile.width; + sy = tile.y * tile.height; + width = tile.width; + } + + if (right && right.collides) + { + width += tile.width; + } + else + { + var body = this.game.physics.createBody(sx, sy, 0, false); + + body.addRectangle(width, tile.height, width / 2, tile.height / 2, 0); + + if (addToWorld) + { + this.game.physics.addBody(body.data); + } + + this.layers[layer].bodies.push(body); + + width = 0; + } + } + } + } + + return this.layers[layer].bodies; + + }, + + /** + * Converts all of the polylines inside a Tiled ObjectGroup into physics bodies that are added to the world. + * Note that the polylines must be created in such a way that they can withstand polygon decomposition. + * + * @method Phaser.Tilemap#createCollisionObjects + * @param {string} [layer] - The Tiled layer to operate on that contains the collision data. + * @param {boolean} [addToWorld=true] - If true it will automatically add each body to the world. + * @return {array} An array of the Phaser.Physics.Body objects that have been created. + */ + createCollisionObjects: function (layer, addToWorld) { + + if (typeof addToWorld === 'undefined') { addToWorld = true; } + + var output = []; + + for (var i = 0, len = this.collision[layer].length; i < len; i++) + { + // name: json.layers[i].objects[v].name, + // x: json.layers[i].objects[v].x, + // y: json.layers[i].objects[v].y, + // width: json.layers[i].objects[v].width, + // height: json.layers[i].objects[v].height, + // visible: json.layers[i].objects[v].visible, + // properties: json.layers[i].objects[v].properties, + // polyline: json.layers[i].objects[v].polyline + + var object = this.collision[layer][i]; + + var body = this.game.physics.createBody(object.x, object.y, 0, addToWorld, {}, object.polyline); + + if (body) + { + output.push(body); + } + + } + + return output; + + }, + /** * 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. @@ -1745,7 +1893,7 @@ Phaser.Tilemap.prototype.constructor = Phaser.Tilemap; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/TilemapLayer.js.html b/docs/TilemapLayer.js.html index c16427e1..6c30c7b0 100644 --- a/docs/TilemapLayer.js.html +++ b/docs/TilemapLayer.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1350,7 +1358,7 @@ Object.defineProperty(Phaser.TilemapLayer.prototype, "collisionHeight", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/TilemapParser.js.html b/docs/TilemapParser.js.html index feee6acd..0c492dad 100644 --- a/docs/TilemapParser.js.html +++ b/docs/TilemapParser.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -540,7 +548,7 @@ Phaser.TilemapParser = { } else { - return { layers: [], objects: [], images: [], tilesets: [] }; + return this.getEmptyData(); } }, @@ -584,6 +592,58 @@ Phaser.TilemapParser = { }, + /** + * Returns an empty map data object. + * @method Phaser.TilemapParser.getEmptyData + * @return {object} Generated map data. + */ + getEmptyData: function () { + + var map = {}; + + map.width = 0; + map.height = 0; + map.tileWidth = 0; + map.tileHeight = 0; + map.orientation = 'orthogonal'; + map.version = '1'; + map.properties = {}; + map.widthInPixels = 0; + map.heightInPixels = 0; + + var layers = []; + + var layer = { + + name: 'layer', + x: 0, + y: 0, + width: 0, + height: 0, + widthInPixels: 0, + heightInPixels: 0, + alpha: 1, + visible: true, + properties: {}, + indexes: [], + callbacks: [], + data: [] + + }; + + layers.push(layer); + + map.layers = layers; + map.images = []; + map.objects = {}; + map.collision = {}; + map.tilesets = []; + map.tiles = []; + + return map; + + }, + /** * Parses a Tiled JSON file into valid map data. * @method Phaser.TilemapParser.parseJSON @@ -634,7 +694,8 @@ Phaser.TilemapParser = { visible: json.layers[i].visible, properties: {}, indexes: [], - callbacks: [] + callbacks: [], + bodies: [] }; @@ -716,8 +777,9 @@ Phaser.TilemapParser = { map.images = images; - // Objects + // Objects & Collision Data (polylines, etc) var objects = {}; + var collision = {}; for (var i = 0; i < json.layers.length; i++) { @@ -727,10 +789,11 @@ Phaser.TilemapParser = { } objects[json.layers[i].name] = []; + collision[json.layers[i].name] = []; for (var v = 0, len = json.layers[i].objects.length; v < len; v++) { - // For now we'll just support object tiles + // Object Tiles if (json.layers[i].objects[v].gid) { var object = { @@ -746,11 +809,37 @@ Phaser.TilemapParser = { objects[json.layers[i].name].push(object); } + else if (json.layers[i].objects[v].polyline) + { + var object = { + + name: json.layers[i].objects[v].name, + x: json.layers[i].objects[v].x, + y: json.layers[i].objects[v].y, + width: json.layers[i].objects[v].width, + height: json.layers[i].objects[v].height, + visible: json.layers[i].objects[v].visible, + properties: json.layers[i].objects[v].properties + + }; + + object.polyline = []; + + // Parse the polyline into an array + for (var p = 0; p < json.layers[i].objects[v].polyline.length; p++) + { + object.polyline.push([ json.layers[i].objects[v].polyline[p].x, json.layers[i].objects[v].polyline[p].y ]); + } + + collision[json.layers[i].name].push(object); + + } } } map.objects = objects; + map.collision = collision; // Tilesets var tilesets = []; @@ -848,7 +937,7 @@ Phaser.TilemapParser = { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Tileset.js.html b/docs/Tileset.js.html index 1fd15ec2..8ae7d187 100644 --- a/docs/Tileset.js.html +++ b/docs/Tileset.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -626,7 +634,7 @@ Phaser.Tileset.prototype.constructor = Phaser.Tileset; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Time.js.html b/docs/Time.js.html index 9b78ae92..e5971be2 100644 --- a/docs/Time.js.html +++ b/docs/Time.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -817,7 +825,7 @@ Phaser.Time.prototype.constructor = Phaser.Time; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Timer.js.html b/docs/Timer.js.html index 4f29b7fd..0dcfaaa1 100644 --- a/docs/Timer.js.html +++ b/docs/Timer.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -979,7 +987,7 @@ Phaser.Timer.prototype.constructor = Phaser.Timer; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/TimerEvent.js.html b/docs/TimerEvent.js.html index 41a84f91..c69585f9 100644 --- a/docs/TimerEvent.js.html +++ b/docs/TimerEvent.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -543,7 +551,7 @@ Phaser.TimerEvent.prototype.constructor = Phaser.TimerEvent; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Touch.js.html b/docs/Touch.js.html index e309954b..9a85c4f4 100644 --- a/docs/Touch.js.html +++ b/docs/Touch.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -807,12 +815,12 @@ Phaser.Touch.prototype = { if (this.game.device.touch) { - this.game.stage.canvas.removeEventListener('touchstart', this._onTouchStart); - this.game.stage.canvas.removeEventListener('touchmove', this._onTouchMove); - this.game.stage.canvas.removeEventListener('touchend', this._onTouchEnd); - this.game.stage.canvas.removeEventListener('touchenter', this._onTouchEnter); - this.game.stage.canvas.removeEventListener('touchleave', this._onTouchLeave); - this.game.stage.canvas.removeEventListener('touchcancel', this._onTouchCancel); + this.game.canvas.removeEventListener('touchstart', this._onTouchStart); + this.game.canvas.removeEventListener('touchmove', this._onTouchMove); + this.game.canvas.removeEventListener('touchend', this._onTouchEnd); + this.game.canvas.removeEventListener('touchenter', this._onTouchEnter); + this.game.canvas.removeEventListener('touchleave', this._onTouchLeave); + this.game.canvas.removeEventListener('touchcancel', this._onTouchCancel); } } @@ -841,7 +849,7 @@ Phaser.Touch.prototype.constructor = Phaser.Touch; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Tween.js.html b/docs/Tween.js.html index 83f6136a..c0997142 100644 --- a/docs/Tween.js.html +++ b/docs/Tween.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -1049,7 +1057,7 @@ Phaser.Tween.prototype.constructor = Phaser.Tween; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/TweenManager.js.html b/docs/TweenManager.js.html index a673e730..b3eaaa94 100644 --- a/docs/TweenManager.js.html +++ b/docs/TweenManager.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -674,7 +682,7 @@ Phaser.TweenManager.prototype.constructor = Phaser.TweenManager; Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/Utils.js.html b/docs/Utils.js.html index e0c1a76e..3f31d106 100644 --- a/docs/Utils.js.html +++ b/docs/Utils.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -489,9 +497,9 @@ Phaser.Utils = { * dir = 1 (left), 2 (right), 3 (both) * @method Phaser.Utils.pad * @param {string} str - The target string. - * @param {number} len - Description. - * @param {number} pad - the string to pad it out with (defaults to a space). - * @param {number} [dir=3] the direction dir = 1 (left), 2 (right), 3 (both). + * @param {number} len - The number of characters to be added. + * @param {number} pad - The string to pad it out with (defaults to a space). + * @param {number} [dir=3] The direction dir = 1 (left), 2 (right), 3 (both). * @return {string} The padded string */ pad: function (str, len, pad, dir) { @@ -775,7 +783,7 @@ if (!Array.isArray) { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:16 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/World.js.html b/docs/World.js.html index 34124778..f0e1548f 100644 --- a/docs/World.js.html +++ b/docs/World.js.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -490,7 +498,7 @@ Phaser.World = function (game) { */ this.currentRenderOrderID = 0; -}; +} Phaser.World.prototype = Object.create(Phaser.Group.prototype); Phaser.World.prototype.constructor = Phaser.World; @@ -509,84 +517,7 @@ Phaser.World.prototype.boot = function () { 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#preUpdate -*/ -Phaser.World.prototype.preUpdate = function () { - - this.currentRenderOrderID = 0; - - for (var i = 0, len = this.children.length; i < len; i++) - { - if (this.children[i]['preUpdate']) - { - this.children[i].preUpdate(); - } - } - -} - -/** -* This is called automatically after the State.update, but before particles or plugins update. -* Most objects won't have an update method set unless explicitly given one. -* -* @method Phaser.World#update -*/ -Phaser.World.prototype.update = function () { - - for (var i = 0, len = this.children.length; i < len; i++) - { - if (this.children[i]['update']) - { - this.children[i].update(); - } - } - -} - -/** -* This is called automatically before the renderer runs and after the plugins have updated. -* In postUpdate this is where all the final physics calculatations and object positioning happens. -* The objects are processed in the order of the display list. -* The only exception to this is if the camera is following an object, in which case that is updated first. -* -* @method Phaser.World#postUpdate -*/ -Phaser.World.prototype.postUpdate = function () { - - if (this.camera.target && this.camera.target['postUpdate']) - { - this.camera.target.postUpdate(); - - this.camera.update(); - - for (var i = 0, len = this.children.length; i < len; i++) - { - if (this.children[i]['postUpdate']) - { - this.children[i].postUpdate(); - } - } - } - else - { - this.camera.update(); - - for (var i = 0, len = this.children.length; i < len; i++) - { - if (this.children[i]['postUpdate']) - { - this.children[i].postUpdate(); - } - } - } + this.game.stage.addChild(this); } @@ -629,8 +560,7 @@ Phaser.World.prototype.setBounds = function (x, y, width, height) { */ Phaser.World.prototype.destroy = function () { - this.camera.x = 0; - this.camera.y = 0; + this.camera.reset(); this.game.input.reset(true); @@ -761,7 +691,7 @@ Object.defineProperty(Phaser.World.prototype, "randomY", { Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:40 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/classes.list.html b/docs/classes.list.html index d5fde758..fbd4ce09 100644 --- a/docs/classes.list.html +++ b/docs/classes.list.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -518,6 +526,9 @@
    BitmapData
    +
    BitmapFont
    +
    +
    BitmapText
    @@ -542,9 +553,6 @@
    Device
    -
    DOMSprite
    -
    -
    Easing
    @@ -581,6 +589,9 @@
    Sinusoidal
    +
    Ellipse
    +
    +
    Events
    @@ -662,9 +673,6 @@
    Arcade
    -
    Body
    -
    -
    Plugin
    @@ -692,9 +700,6 @@
    RenderTexture
    -
    RenderTexture
    -
    -
    RequestAnimationFrame
    @@ -713,7 +718,7 @@
    Sprite
    -
    Sprite
    +
    SpriteBatch
    Stage
    @@ -817,7 +822,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/global.html b/docs/global.html index 307c8d56..d4c64252 100644 --- a/docs/global.html +++ b/docs/global.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -601,6 +609,98 @@ + + + + +
    +

    getBounds() → {Phaser.Rectangle}

    + + +
    +
    + + +
    +

    Returns the framing rectangle of the ellipse as a Phaser.Rectangle object.

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

    The framing rectangle

    +
    + + + +
    +
    + Type +
    +
    + +Phaser.Rectangle + + +
    +
    + + + + +
    @@ -1125,7 +1225,7 @@ this function is taken from Starling Framework as its pretty neat ;)

    Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/index.html b/docs/index.html index b2fb68f7..335e16dc 100644 --- a/docs/index.html +++ b/docs/index.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -506,8 +514,8 @@

    Version 1.2 - "Shienar" - -in development-

    Significant API changes:

      -
    • 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.
    • +
    • Upgraded to Pixi.js 1.5.2
    • +
    • Group now extends PIXI.DisplayObjectContainer, rather than owning a _container property, which makes life a whole lot easier re: nesting and child iteration.
    • 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.
    • @@ -515,32 +523,84 @@
    • 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.
    • +
    • 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.
    • +
    • Text.content has been replaced with Text.text. The Text class has a lot of new methods, check the docs!
    • +
    • Loader won't set crossOrigin on Images unless it's set to something. The default is false, it used to be '' and can be any valid string.
    • +
    • Sprite.input.pixelPerfect has been split into two: Sprite.input.pixelPerfectClick and Sprite.input.pixelPerfectOver (see new features)
    • +
    • Phaser.Stage now extends PIXI.Stage, rather than containing a _stage object.
    • +
    • If you set Sprite.exists to false it will also set Sprite.visible to false and remove its body from the physics world (if it has one).
    • +
    • If you set Sprite.exists to true it will also set Sprite.visible to true and add its body back into the physics world (if it has one).
    • +
    • Stage.scale has been moved to Game.scale. The same game scaling properties exist as before, but now accessed via Game.scale instead.
    • +
    • Stage.aspectRatio has been moved to StageScaleMode.sourceAspectRatio (so now game.scale.sourceAspectRatio)
    • +
    • Stage.scaleMode has been moved to StageScaleMode.scaleMode (so now game.scale.scaleMode)
    • +
    • Stage.fullScreenScaleMode has been moved to StageScaleMode.fullScreenScaleMode (so now game.scale.fullScreenScaleMode)
    • +
    • Stage.canvas has been moved to Game.canvas (which used to be a reference to Stage.canvas, but is now the actual object).
    • +
    • BitmapData.addTo removed and enhanced BitmapData.add so it can accept either a single Sprite/Image or an Array of them.
    • +
    • BitmapData has had all of the EaselJS functions removed. It was just taking up space and you can do it all via BitmapData.context directly.
    • +
    • BitmapText has had a bit of an overhaul - the signature for adding a BitmapText has changed to: x, y, font, text, size. See the docs and examples for details.
    • +
    • World preUpdate, update and postUpdate have all been moved to Stage. So all children are updated regardless where on the display list they live.
    • +
    • Cache.getImageKeys and similar has been removed, please use Cache.getKeys(Phaser.Cache.IMAGE) instead, this now supports all 10 Cache data types.
    • +
    • After defining tiles that collide on a Tilemap, you need to call Tilemap.generateCollisionData(layer) to populate the physics world with the data required.

    New features:

      -
    • 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.
    • +
    • Phaser.Image is a brand new display object perfect for logos, backgrounds, etc. You can scale, rotate, tint, blend an get input events from an Image, but it has no animation, physics body.
    • 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.
    • +
    • Text has lots of new methods to help style it: Text.fill, Text.align, Text.stroke, etc.
    • +
    • Text now works happily with font names with spaces in them.
    • +
    • Text.setShadow applies a drop shadow to the Text being rendered. Control the x, y, color and blur.
    • +
    • Text.lineSpacing allows you to set additional spacing between each line that is rendered.
    • +
    • Text.inputEnabled allows you to enable all input events over Text objects: dragging, clicking, etc - anything that works on a Sprite works on Text now too.
    • +
    • Phaser.Ellipse added. A fully compatible port of the PIXI.Ellipse class, can be used in Sprite/Image hitArea tests.
    • +
    • Phaser.Polygon added. A fully compatible port of the PIXI.Polygon class, can be used in Sprite/Image hitArea tests.
    • +
    • InputHandler.pixelPerfectOver - performs a pixel perfect check to see if any pointer is over the current object (warning: very expensive!)
    • +
    • InputHandler.pixelPerfectClick - performs a pixel perfect check but only when the pointer touches/clicks on the current object.
    • +
    • TileSprite can now use a frame from a texture atlas or a sprite sheet.
    • +
    • TileSprites can now be animated. See new example :)
    • +
    • TileSprites have a new method: autoScroll(x, y) which sets an automatic scroll running (until stopped with TileSprite.stopScroll).
    • +
    • BitmapText now uses the new XML parser which should work under CocoonJS without clashes.
    • +
    • BitmapText signature changed so you can support fonts with spaces in their names.
    • +
    • Loader.bitmapFont now has 2 extra parameters: xSpacing and ySpacing. These allow you to add extra spacing to each letter or line of the font.
    • +
    • Added the new BitmapFont class. This is for rendering retro style fixed-width bitmap fonts into an Image object. It's a texture you can apply to a Sprite/Image.
    • +
    • Added Cache.updateFrameData which is really useful for swapping FrameData blocks in the cache.
    • +
    • Loader.physics now lets you load Lime + Corona JSON Physics data, which can be used with Body.loadPolygon and Body.loadData.
    • +
    • Cache.addPhysicsData and Cache.getPhysicsData allow you to store parsed JSON physics data in the cache, for sharing between Bodies.
    • +
    • fixedToCamera now works across all display objects. When enabled it will fix at its current x/y coordinate, but can be changed via cameraOffset.
    • +
    • fixedToCamrea now works for Groups as well :) You can fix a Group to the camera and it will influence its children.
    • +
    • Tilemap.createCollisionObjects will parse Tiled data for objectgroups and convert polyline instances into physics objects you can collide with in the world.
    -

    New Examples:

    Updates:

      +
    • Massive thanks to clark-stevenson for doing an amazing job update the TypeScript definitions file.
    • 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'.
    • +
    • World.reset now calls Camera.reset which sends the camera back to 0,0 and un-follows any object it may have been tracking.
    • +
    • Added hostname: '*' to the grunt-connect in Gruntfile.js (fixes #426)

    Bug Fixes:

    • 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.
    • +
    • Previously if you used Sprite.crop() it would crop all Sprites that shared 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.
    • +
    • Fixed bug where changing State would cause the camera to not reset if it was following an object.
    • +
    • Tile had 2 properties (callback and callbackContext) that were never assigned, updated to use the proper names (thanks ratkingsimon)
    • +
    • Fixed an error that would occur if you used InputHandler.onInputUp and the Sprite destroys itself during the event.
    • +
    • IE11 didn't populate the Device.ieVersion value. Now extracted from Trident revision, but still use Device.trident instead for IE11+ checks.
    • +
    • Fixed bug in Math.angleBetween where it was using the coordinates in the wrong order.
    • +
    • Previously using a Pixel Perfect check didn't work if the Sprite was rotated or had a non-zero anchor point, now works under all conditions + atlas frames.
    • +
    • If pixelPerfect Input Sprites overlapped each other the pixel check wasn't taken into consieration in the Pointer move method.
    • +
    +

    TO DO:

    +
      +
    • If you change the frame name of a pixel precise input Sprite, it will fail all clicks on it after the frame change.

    You can view the Change Log for all previous versions at https://github.com/photonstorm/phaser/changelog.md

    How to Build

    @@ -675,7 +735,7 @@ Sprites also have full Input support: click them, touch them, drag them around, Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/docs/namespaces.list.html b/docs/namespaces.list.html index d4f4332b..f228419a 100644 --- a/docs/namespaces.list.html +++ b/docs/namespaces.list.html @@ -58,6 +58,10 @@ BitmapData +
  • + BitmapFont +
  • +
  • BitmapText
  • @@ -90,10 +94,6 @@ Device -
  • - DOMSprite -
  • -
  • Easing
  • @@ -142,6 +142,10 @@ Sinusoidal +
  • + Ellipse +
  • +
  • Events
  • @@ -250,10 +254,6 @@ Arcade -
  • - Body -
  • -
  • Plugin
  • @@ -314,6 +314,10 @@ Sprite +
  • + SpriteBatch +
  • +
  • Stage
  • @@ -412,6 +416,10 @@ canUseNewCanvasBlendModes +
  • + getBounds +
  • +
  • getNextPowerOfTwo
  • @@ -518,6 +526,9 @@
    BitmapData
    +
    BitmapFont
    +
    +
    BitmapText
    @@ -542,9 +553,6 @@
    Device
    -
    DOMSprite
    -
    -
    Easing
    @@ -581,6 +589,9 @@
    Sinusoidal
    +
    Ellipse
    +
    +
    Events
    @@ -662,9 +673,6 @@
    Arcade
    -
    Body
    -
    -
    Plugin
    @@ -692,9 +700,6 @@
    RenderTexture
    -
    RenderTexture
    -
    -
    RequestAnimationFrame
    @@ -713,7 +718,7 @@
    Sprite
    -
    Sprite
    +
    SpriteBatch
    Stage
    @@ -817,7 +822,7 @@ Documentation generated by JSDoc 3.3.0-dev - on Sat Feb 08 2014 07:19:41 GMT-0000 (GMT) using the DocStrap template. + on Tue Feb 18 2014 03:01:17 GMT-0000 (GMT) using the DocStrap template. diff --git a/examples/assets/physics/thrust.json b/examples/assets/physics/thrust.json new file mode 100644 index 00000000..5baa6f86 --- /dev/null +++ b/examples/assets/physics/thrust.json @@ -0,0 +1,12 @@ + { + + "thrust_ship2": [ + + { + "density": 2, "friction": 0, "bounce": 0, + "filter": { "categoryBits": 1, "maskBits": 65535 }, + "shape": [ 29, 23 , 0, 23 , 14, 1 ] + } + ] + + } \ No newline at end of file diff --git a/examples/assets/tilemaps/maps/collision_test.json b/examples/assets/tilemaps/maps/collision_test.json index 6e174023..e6b0a980 100644 --- a/examples/assets/tilemaps/maps/collision_test.json +++ b/examples/assets/tilemaps/maps/collision_test.json @@ -1,7 +1,7 @@ { "height":18, "layers":[ { - "data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 11, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, 11, 11, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 11, 11, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + "data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 11, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 11, 11, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "height":18, "name":"Tile Layer 1", "opacity":1, @@ -15,44 +15,21 @@ "x":0, "y":0 }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 0, 0, 0, 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":18, + "name":"Tile Layer 2", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":50, + "x":0, + "y":0 + }, { "height":18, "name":"collision", "objects":[ - { - "height":0, - "name":"", - "polyline":[ - { - "x":0, - "y":0 - }, - { - "x":0, - "y":224 - }, - { - "x":-32, - "y":224 - }, - { - "x":-32, - "y":-32 - }, - { - "x":1568, - "y":-32 - }], - "properties": - { - - }, - "type":"", - "visible":true, - "width":0, - "x":32, - "y":32 - }, { "height":0, "name":"", @@ -169,274 +146,6 @@ "x":416, "y":96 }, - { - "height":0, - "name":"", - "polyline":[ - { - "x":0, - "y":0 - }, - { - "x":32, - "y":0 - }, - { - "x":96, - "y":32 - }, - { - "x":160, - "y":32 - }, - { - "x":160, - "y":64 - }, - { - "x":32, - "y":64 - }, - { - "x":32, - "y":224 - }, - { - "x":960, - "y":224 - }, - { - "x":960, - "y":160 - }, - { - "x":992, - "y":128 - }, - { - "x":1024, - "y":128 - }, - { - "x":1024, - "y":64 - }, - { - "x":928, - "y":64 - }, - { - "x":896, - "y":32 - }, - { - "x":896, - "y":0 - }, - { - "x":928, - "y":0 - }, - { - "x":960, - "y":32 - }, - { - "x":992, - "y":0 - }, - { - "x":992, - "y":-128 - }, - { - "x":1024, - "y":-128 - }, - { - "x":1024, - "y":-160 - }, - { - "x":1088, - "y":-160 - }, - { - "x":1088, - "y":-128 - }, - { - "x":1120, - "y":-128 - }, - { - "x":1120, - "y":32 - }, - { - "x":1152, - "y":32 - }, - { - "x":1184, - "y":0 - }, - { - "x":1184, - "y":-64 - }, - { - "x":1216, - "y":-64 - }], - "properties": - { - - }, - "type":"", - "visible":true, - "width":0, - "x":0, - "y":320 - }, - { - "height":0, - "name":"", - "polyline":[ - { - "x":0, - "y":0 - }, - { - "x":96, - "y":0 - }, - { - "x":96, - "y":32 - }, - { - "x":64, - "y":32 - }, - { - "x":64, - "y":64 - }, - { - "x":0, - "y":64 - }, - { - "x":0, - "y":96 - }, - { - "x":-32, - "y":128 - }, - { - "x":-128, - "y":128 - }, - { - "x":-128, - "y":192 - }, - { - "x":-96, - "y":192 - }, - { - "x":-64, - "y":224 - }, - { - "x":-64, - "y":288 - }, - { - "x":320, - "y":288 - }], - "properties": - { - - }, - "type":"", - "visible":true, - "width":0, - "x":1216, - "y":256 - }, - { - "height":0, - "name":"", - "polyline":[ - { - "x":0, - "y":0 - }, - { - "x":32, - "y":0 - }, - { - "x":32, - "y":-512 - }, - { - "x":-256, - "y":-512 - }, - { - "x":-256, - "y":-480 - }, - { - "x":-352, - "y":-480 - }, - { - "x":-352, - "y":-512 - }, - { - "x":-1152, - "y":-512 - }], - "properties": - { - - }, - "type":"", - "visible":true, - "width":0, - "x":1536, - "y":544 - }, - { - "height":0, - "name":"", - "polyline":[ - { - "x":0, - "y":0 - }, - { - "x":-352, - "y":0 - }], - "properties": - { - - }, - "type":"", - "visible":true, - "width":0, - "x":384, - "y":32 - }, { "height":0, "name":"platform", @@ -511,100 +220,6 @@ "x":192, "y":352 }, - { - "height":0, - "name":"", - "polyline":[ - { - "x":0, - "y":0 - }, - { - "x":0, - "y":-32 - }, - { - "x":32, - "y":-32 - }, - { - "x":64, - "y":-32 - }, - { - "x":96, - "y":-64 - }, - { - "x":96, - "y":-128 - }, - { - "x":160, - "y":-128 - }, - { - "x":192, - "y":-160 - }, - { - "x":256, - "y":-160 - }, - { - "x":256, - "y":-128 - }, - { - "x":288, - "y":-128 - }, - { - "x":288, - "y":-160 - }, - { - "x":352, - "y":-160 - }, - { - "x":352, - "y":-128 - }, - { - "x":288, - "y":-128 - }, - { - "x":288, - "y":-96 - }, - { - "x":128, - "y":-96 - }, - { - "x":128, - "y":-32 - }, - { - "x":96, - "y":0 - }, - { - "x":0, - "y":0 - }], - "properties": - { - - }, - "type":"", - "visible":true, - "width":0, - "x":256, - "y":480 - }, { "ellipse":true, "height":64, @@ -619,32 +234,6 @@ "x":704, "y":288 }, - { - "height":0, - "name":"", - "polygon":[ - { - "x":0, - "y":0 - }, - { - "x":32, - "y":-32 - }, - { - "x":64, - "y":0 - }], - "properties": - { - - }, - "type":"", - "visible":true, - "width":0, - "x":416, - "y":544 - }, { "height":0, "name":"", @@ -711,32 +300,6 @@ "x":608, "y":480 }, - { - "height":0, - "name":"", - "polygon":[ - { - "x":0, - "y":0 - }, - { - "x":96, - "y":-64 - }, - { - "x":192, - "y":0 - }], - "properties": - { - - }, - "type":"", - "visible":true, - "width":0, - "x":736, - "y":544 - }, { "height":0, "name":"", @@ -818,6 +381,92 @@ "width":0, "x":1472, "y":64 + }, + { + "height":0, + "name":"", + "polyline":[ + { + "x":0, + "y":0 + }, + { + "x":96, + "y":0 + }, + { + "x":96, + "y":-96 + }, + { + "x":192, + "y":-96 + }, + { + "x":192, + "y":-128 + }, + { + "x":256, + "y":-128 + }, + { + "x":256, + "y":-96 + }, + { + "x":288, + "y":-96 + }, + { + "x":288, + "y":-128 + }, + { + "x":352, + "y":-128 + }, + { + "x":352, + "y":-96 + }, + { + "x":320, + "y":-96 + }, + { + "x":288, + "y":-64 + }, + { + "x":128, + "y":-64 + }, + { + "x":128, + "y":0 + }, + { + "x":96, + "y":32 + }, + { + "x":0, + "y":32 + }, + { + "x":0, + "y":0 + }], + "properties": + { + + }, + "type":"", + "visible":true, + "width":0, + "x":256, + "y":448 }], "opacity":1, "type":"objectgroup", diff --git a/examples/assets/tilemaps/tmx/collision test.tmx b/examples/assets/tilemaps/tmx/collision test.tmx index 66400170..f7b0aa53 100644 --- a/examples/assets/tilemaps/tmx/collision test.tmx +++ b/examples/assets/tilemaps/tmx/collision test.tmx @@ -22,51 +22,35 @@ - AQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAJAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAsAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAALAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAACwAAAAsAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAACQAAAAEAAAABAAAAAQAAAAEAAAABAAAACQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAA + AQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAJAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAsAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAALAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAACwAAAAsAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAACQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAACQAAAAEAAAABAAAAAQAAAAEAAAABAAAACQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAA + + + + + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE0AAAAAAAAAAAAAAAAAAAAAAAAATQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - - - - - - - - - - - - - - - - - - - - - - - - + + + diff --git a/examples/wip/tilemap1.js b/examples/wip/tilemap1.js index 1aa30616..a1b2737e 100644 --- a/examples/wip/tilemap1.js +++ b/examples/wip/tilemap1.js @@ -22,6 +22,7 @@ var p; var b; var cursors; var box2; +var dump; function create() { @@ -34,14 +35,22 @@ function create() { map.addTilesetImage('tiles2'); layer = map.createLayer('Tile Layer 1'); + layer.resizeWorld(); + map.setCollisionBetween(1, 12); + + // layer.debug = true; + + dump = map.generateCollisionData(layer); + + // dump = map.createCollisionObjects('collision'); + + // console.log(dump); + // console.log(dump[7]); - - - - ship = game.add.sprite(200, 200, 'ship'); + // ship = game.add.sprite(200, 200, 'ship'); // ship.physicsEnabled = true; @@ -60,14 +69,13 @@ function create() { // b.body.fixedRotation = true; // b.body.static = true; - var data = [[0,0] , [0, -32] , [32, -64] , [64, -64] , [64,-96], [128,-96], [160,-128], [192,-128], [192,-96], [160,-64], [96,-64], [96,-32], [32,-32], [32,0]]; + // var data = [[0,0] , [0, -32] , [32, -64] , [64, -64] , [64,-96], [128,-96], [160,-128], [192,-128], [192,-96], [160,-64], [96,-64], [96,-32], [32,-32], [32,0], [0,0]]; + // b = game.physics.createBody(192, 352, 0, true, { removeCollinearPoints: true }, data); + // b = game.physics.createBody(32, 32, 0, true, { removeCollinearPoints: true }, data); + // b = game.physics.createBody(256, 480, 0, true, { removeCollinearPoints: true }, data); - // "x":192, - // "y":352 - - b = game.physics.createBody(192, 352, 0, true, {}, data); - - // console.log(output); + // console.log('DATA'); + // console.log(data); // var re = b.body.addPolygon({removeCollinearPoints:true}, data); // var re = b.body.addPolygon({removeCollinearPoints:true}, data); @@ -78,14 +86,12 @@ function create() { // console.log(b.body.data.shapes[0].vertices); box2 = game.add.sprite(200, 200, 'box'); - box2.name = 'bob'; - box2.anchor.set(0.5); + // box2.name = 'bob'; + // box2.anchor.set(0.5); box2.physicsEnabled = true; - // box2.body.mass = 1; - // box2.body.data.motionState = 1; box2.body.fixedRotation = true; - // game.camera.follow(p); + game.camera.follow(box2); cursors = game.input.keyboard.createCursorKeys(); @@ -150,13 +156,20 @@ function render() { // game.debug.renderCameraInfo(game.camera, 420, 320); - game.debug.renderText(box2.body.velocity.x, 32, 32); - game.debug.renderText(box2.body.velocity.y, 32, 64); + // game.debug.renderText(box2.body.velocity.x, 32, 32); + // game.debug.renderText(box2.body.velocity.y, 32, 64); // game.debug.renderText(b.body.velocity.x, 32, 32); // game.debug.renderText(b.body.velocity.y, 32, 64); - game.debug.renderPhysicsBody(b); + for (var i = 0, len = dump.length; i < len; i++) + { + game.debug.renderPhysicsBody(dump[i]); + } + + // game.debug.renderPhysicsBody(dump[0]); + // game.debug.renderPhysicsBody(b); + // game.debug.renderPhysicsBody(ship.body); diff --git a/examples/wip/tilemap2.js b/examples/wip/tilemap2.js new file mode 100644 index 00000000..6329ecfe --- /dev/null +++ b/examples/wip/tilemap2.js @@ -0,0 +1,84 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); +// var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +function preload() { + + game.load.tilemap('map', 'assets/tilemaps/maps/collision_test.json', null, Phaser.Tilemap.TILED_JSON); + game.load.image('ground_1x1', 'assets/tilemaps/tiles/ground_1x1.png'); + game.load.image('tiles2', 'assets/tilemaps/tiles/tiles2.png'); + game.load.image('ufo', 'assets/sprites/ufo.png'); + game.load.image('ship', 'assets/sprites/thrust_ship2.png'); + +} + +var ship; +var map; +var layer; +var cursors; +var dump; + +function create() { + + game.stage.backgroundColor = '#2d2d2d'; + + map = game.add.tilemap('map'); + + map.addTilesetImage('ground_1x1'); + map.addTilesetImage('tiles2'); + + map.setCollisionBetween(1, 12); + + layer = map.createLayer('Tile Layer 1'); + + layer.resizeWorld(); + + dump = map.generateCollisionData(layer); + + ship = game.add.sprite(200, 200, 'ship'); + ship.physicsEnabled = true; + // We do this because our ship is shaped like a triangle, not a square :) + ship.body.addPolygon({}, 29, 23 , 0, 23 , 14, 1); + + game.camera.follow(ship); + + cursors = game.input.keyboard.createCursorKeys(); + +} + +function update() { + + if (cursors.left.isDown) + { + ship.body.rotateLeft(100); + } + else if (cursors.right.isDown) + { + ship.body.rotateRight(100); + } + else + { + ship.body.setZeroRotation(); + } + + if (cursors.up.isDown) + { + ship.body.thrust(400); + } + else if (cursors.down.isDown) + { + ship.body.reverse(400); + } + +} + +function render() { + + for (var i = 0, len = dump.length; i < len; i++) + { + // game.debug.renderPhysicsBody(dump[i]); + } + + // game.debug.renderPhysicsBody(ship.body); + +} diff --git a/package.json b/package.json index 75e8c09f..f542e0cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Phaser", - "version": "1.1.5", + "version": "1.2", "description": "A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers.", "author": "Richard Davey", "logo": "https://raw.github.com/photonstorm/phaser/master/phaser-logo-small.png", diff --git a/src/core/Filter.js b/src/core/Filter.js index 229e4fe0..34fc5178 100644 --- a/src/core/Filter.js +++ b/src/core/Filter.js @@ -36,8 +36,7 @@ Phaser.Filter = function (game, uniforms, fragmentSrc) { this.passes = [this]; /** - * @property shaders - * @type Array an array of shaders + * @property {array} shaders - Array an array of shaders. * @private */ this.shaders = []; diff --git a/src/physics/Body.js b/src/physics/Body.js index 5630f162..9cb39eeb 100644 --- a/src/physics/Body.js +++ b/src/physics/Body.js @@ -222,6 +222,23 @@ Phaser.Physics.Body.prototype = { }, + /** + * Applies a force to the Body that causes it to 'thrust' backwards (in reverse), based on its current angle and the given speed. + * The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms). + * + * @method Phaser.Physics.Body#rever + * @param {number} speed - The speed at which it should reverse. + */ + reverse: function (speed) { + + var magnitude = this.px2p(-speed); + var angle = this.data.angle + Math.PI / 2; + + this.data.force[0] -= magnitude * Math.cos(angle); + this.data.force[1] -= magnitude * Math.sin(angle); + + }, + /** * If this Body is dynamic then this will move it to the left by setting its x velocity to the given speed. * The speed is represented in pixels per second. So a value of 100 would move 100 pixels in 1 second (1000ms). @@ -231,8 +248,7 @@ Phaser.Physics.Body.prototype = { */ moveLeft: function (speed) { - // this.data.velocity[0] = this.px2p(-speed); - this.data.force[0] += this.px2p(-speed); + this.data.velocity[0] = this.px2p(-speed); }, @@ -245,8 +261,7 @@ Phaser.Physics.Body.prototype = { */ moveRight: function (speed) { - // this.data.velocity[0] = this.px2p(speed); - this.data.force[0] += this.px2p(speed); + this.data.velocity[0] = this.px2p(speed); }, @@ -259,8 +274,7 @@ Phaser.Physics.Body.prototype = { */ moveUp: function (speed) { - // this.data.velocity[1] = this.px2p(-speed); - this.data.force[1] += this.px2p(-speed); + this.data.velocity[1] = this.px2p(-speed); }, @@ -273,8 +287,7 @@ Phaser.Physics.Body.prototype = { */ moveDown: function (speed) { - // this.data.velocity[1] = this.px2p(speed); - this.data.force[1] += this.px2p(speed); + this.data.velocity[1] = this.px2p(speed); }, @@ -551,14 +564,19 @@ Phaser.Physics.Body.prototype = { // Did they pass in a single array of points? if (points.length === 1 && Array.isArray(points[0])) { - path = path.concat(points[0]); + path = points[0].slice(0); } else if (Array.isArray(points[0])) { - path = path.concat(points); + path = points[0].slice(0); + // for (var i = 0, len = points[0].length; i < len; i += 2) + // { + // path.push([points[0][i], points[0][i + 1]]); + // } } else if (typeof points[0] === 'number') { + // console.log('addPolygon --- We\'ve a list of numbers'); // We've a list of numbers for (var i = 0, len = points.length; i < len; i += 2) { @@ -566,6 +584,18 @@ Phaser.Physics.Body.prototype = { } } + // console.log('addPolygon PATH pre'); + // console.log(path[1]); + // console.table(path); + + // top and tail + var idx = path.length - 1; + + if ( path[idx][0] === path[0][0] && path[idx][1] === path[0][1] ) + { + path.pop(); + } + // Now process them into p2 values for (var p = 0; p < path.length; p++) { @@ -573,6 +603,10 @@ Phaser.Physics.Body.prototype = { path[p][1] = this.px2p(path[p][1]); } + // console.log('addPolygon PATH POST'); + // console.log(path[1]); + // console.table(path); + return this.data.fromPolygon(path, options); }, diff --git a/src/physics/World.js b/src/physics/World.js index 863f2778..882afce2 100644 --- a/src/physics/World.js +++ b/src/physics/World.js @@ -255,7 +255,12 @@ Phaser.Physics.World.prototype.createBody = function (x, y, mass, addToWorld, op if (data) { - body.addPolygon(options, data); + var result = body.addPolygon(options, data); + + if (!result) + { + return false; + } } if (addToWorld) diff --git a/src/pixi/InteractionManager.js b/src/pixi/InteractionManager.js index b80f1440..8153bebf 100644 --- a/src/pixi/InteractionManager.js +++ b/src/pixi/InteractionManager.js @@ -124,7 +124,7 @@ PIXI.InteractionManager.prototype.collectInteractiveSprite = function(displayObj var child = children[i]; // push all interactive bits - if(child.interactive) + if(child._interactive) { iParent.interactiveChildren = true; //child.__iParent = iParent; diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index 6d8739eb..44424819 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -194,6 +194,10 @@ PIXI.DisplayObject = function() */ this._mask = null; + this._cacheAsBitmap = false; + this._cacheIsDirty = false; + + /* * MOUSE Callbacks */ @@ -379,6 +383,28 @@ Object.defineProperty(PIXI.DisplayObject.prototype, 'filters', { } }); +Object.defineProperty(PIXI.DisplayObject.prototype, 'cacheAsBitmap', { + get: function() { + return this._cacheAsBitmap; + }, + set: function(value) { + + if(this._cacheAsBitmap === value)return; + + if(value) + { + //this._cacheIsDirty = true; + this._generateCachedSprite(); + } + else + { + this._destroyCachedSprite(); + } + + this._cacheAsBitmap = value; + } +}); + /* * Updates the object transform for rendering * @@ -399,6 +425,7 @@ PIXI.DisplayObject.prototype.updateTransform = function() // var localTransform = this.localTransform//.toArray(); var parentTransform = this.parent.worldTransform;//.toArray(); var worldTransform = this.worldTransform;//.toArray(); + var px = this.pivot.x; var py = this.pivot.y; @@ -442,11 +469,10 @@ PIXI.DisplayObject.prototype.getBounds = function( matrix ) */ PIXI.DisplayObject.prototype.getLocalBounds = function() { - //var matrixCache = this.worldTransform; - return this.getBounds(PIXI.identityMatrix);///PIXI.EmptyRectangle(); }; + /** * Sets the object's stage reference, the stage this object is connected to * @@ -459,6 +485,62 @@ PIXI.DisplayObject.prototype.setStageReference = function(stage) if(this._interactive)this.stage.dirty = true; }; +PIXI.DisplayObject.prototype.generateTexture = function(renderer) +{ + var bounds = this.getLocalBounds(); + + var renderTexture = new PIXI.RenderTexture(bounds.width | 0, bounds.height | 0, renderer); + renderTexture.render(this); + + return renderTexture; +}; + +PIXI.DisplayObject.prototype.updateCache = function() +{ + this._generateCachedSprite(); +}; + +PIXI.DisplayObject.prototype._renderCachedSprite = function(renderSession) +{ + if(renderSession.gl) + { + PIXI.Sprite.prototype._renderWebGL.call(this._cachedSprite, renderSession); + } + else + { + PIXI.Sprite.prototype._renderCanvas.call(this._cachedSprite, renderSession); + } +}; + +PIXI.DisplayObject.prototype._generateCachedSprite = function()//renderSession) +{ + this._cacheAsBitmap = false; + var bounds = this.getLocalBounds(); + + if(!this._cachedSprite) + { + var renderTexture = new PIXI.RenderTexture(bounds.width | 0, bounds.height | 0);//, renderSession.renderer); + + this._cachedSprite = new PIXI.Sprite(renderTexture); + this._cachedSprite.worldTransform = this.worldTransform; + } + else + { + this._cachedSprite.texture.resize(bounds.width | 0, bounds.height | 0); + } + + //REMOVE filter! + var tempFilters = this._filters; + this._filters = null; + + this._cachedSprite.filters = tempFilters; + this._cachedSprite.texture.render(this); + + this._filters = tempFilters; + + this._cacheAsBitmap = true; +}; + /** * Renders the object using the WebGL renderer * @@ -466,6 +548,18 @@ PIXI.DisplayObject.prototype.setStageReference = function(stage) * @param renderSession {RenderSession} * @private */ +PIXI.DisplayObject.prototype._destroyCachedSprite = function() +{ + if(!this._cachedSprite)return; + + this._cachedSprite.texture.destroy(true); + // console.log("DESTROY") + // let the gc collect the unused sprite + // TODO could be object pooled! + this._cachedSprite = null; +}; + + PIXI.DisplayObject.prototype._renderWebGL = function(renderSession) { // OVERWRITE; diff --git a/src/pixi/display/DisplayObjectContainer.js b/src/pixi/display/DisplayObjectContainer.js index d8ad9e92..92ae06e6 100644 --- a/src/pixi/display/DisplayObjectContainer.js +++ b/src/pixi/display/DisplayObjectContainer.js @@ -205,6 +205,8 @@ PIXI.DisplayObjectContainer.prototype.updateTransform = function() PIXI.DisplayObject.prototype.updateTransform.call( this ); + if(this._cacheAsBitmap)return; + for(var i=0,j=this.children.length; i= this.size) + if(texture.baseTexture !== this.currentBaseTexture || this.currentBatchSize >= this.size) { this.flush(); - this.currentBaseTexture = sprite.texture.baseTexture; + this.currentBaseTexture = texture.baseTexture; } @@ -162,8 +164,6 @@ PIXI.WebGLSpriteBatch.prototype.render = function(sprite) var verticies = this.vertices; - var width = sprite.texture.frame.width; - var height = sprite.texture.frame.height; // TODO trim?? var aX = sprite.anchor.x; @@ -177,18 +177,19 @@ PIXI.WebGLSpriteBatch.prototype.render = function(sprite) var trim = sprite.texture.trim; w1 = trim.x - aX * trim.width; - w0 = w1 + width; + w0 = w1 + texture.frame.width; h1 = trim.y - aY * trim.height; - h0 = h1 + height; + h0 = h1 + texture.frame.height; + } else { - w0 = (width ) * (1-aX); - w1 = (width ) * -aX; + w0 = (texture.frame.width ) * (1-aX); + w1 = (texture.frame.width ) * -aX; - h0 = height * (1-aY); - h1 = height * -aY; + h0 = texture.frame.height * (1-aY); + h1 = texture.frame.height * -aY; } var index = this.currentBatchSize * 4 * this.vertSize; diff --git a/src/pixi/textures/BaseTexture.js b/src/pixi/textures/BaseTexture.js index fd65bfd7..ad62d5e4 100644 --- a/src/pixi/textures/BaseTexture.js +++ b/src/pixi/textures/BaseTexture.js @@ -64,6 +64,12 @@ PIXI.BaseTexture = function(source, scaleMode) */ this.source = source; + //TODO will be used for futer pixi 1.5... + this.id = PIXI.BaseTextureCacheIdGenerator++; + + // used for webGL + this._glTextures = []; + if(!source)return; if(this.source.complete || this.source.getContext) @@ -93,11 +99,7 @@ PIXI.BaseTexture = function(source, scaleMode) this.imageUrl = null; this._powerOf2 = false; - //TODO will be used for futer pixi 1.5... - this.id = PIXI.BaseTextureCacheIdGenerator++; - - // used for webGL - this._glTextures = []; + }; diff --git a/src/pixi/textures/RenderTexture.js b/src/pixi/textures/RenderTexture.js index 556933db..cd73f652 100644 --- a/src/pixi/textures/RenderTexture.js +++ b/src/pixi/textures/RenderTexture.js @@ -187,6 +187,8 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, position, cl { var children = displayObject.children; + var originalWorldTransform = displayObject.worldTransform; + displayObject.worldTransform = PIXI.RenderTexture.tempMatrix; if(position) @@ -207,6 +209,9 @@ PIXI.RenderTexture.prototype.renderCanvas = function(displayObject, position, cl this.renderer.renderDisplayObject(displayObject, context); context.setTransform(1,0,0,1,0,0); + + displayObject.worldTransform = originalWorldTransform; }; -PIXI.RenderTexture.tempMatrix = new PIXI.Matrix(); \ No newline at end of file +PIXI.RenderTexture.tempMatrix = new PIXI.Matrix(); + diff --git a/src/pixi/textures/Texture.js b/src/pixi/textures/Texture.js index 2025b7e0..8500a6e6 100644 --- a/src/pixi/textures/Texture.js +++ b/src/pixi/textures/Texture.js @@ -230,7 +230,8 @@ PIXI.Texture.addTextureToCache = function(texture, id) PIXI.Texture.removeTextureFromCache = function(id) { var texture = PIXI.TextureCache[id]; - PIXI.TextureCache[id] = null; + delete PIXI.TextureCache[id]; + delete PIXI.BaseTextureCache[id]; return texture; }; diff --git a/src/tilemap/Tilemap.js b/src/tilemap/Tilemap.js index 284845be..70d03693 100644 --- a/src/tilemap/Tilemap.js +++ b/src/tilemap/Tilemap.js @@ -97,6 +97,11 @@ Phaser.Tilemap = function (game, key) { */ this.objects = data.objects; + /** + * @property {array} collision - An array of collision data (polylines, etc). + */ + this.collision = data.collision; + /** * @property {array} images - An array of Tiled Image Layers. */ @@ -283,6 +288,141 @@ Phaser.Tilemap.prototype = { }, + /** + * Clears all physics bodies from the world for the given layer. + * + * @method Phaser.Tilemap#clearPhysicsBodies + * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer. + */ + clearPhysicsBodies: function (layer) { + + layer = this.getLayer(layer); + + var i = this.layers[layer].bodies.length; + + while (i--) + { + this.layers[layer].bodies[i].destroy(); + } + + }, + + /** + * Goes through all tiles in the given layer and converts those set to collide into physics bodies in the world. + * Only call this *after* you have specified all of the tiles you wish to collide with calls like Tilemap.setCollisionBetween, etc. + * Every time you call this method it will destroy any previously created bodies and remove them from the world. + * Therefore understand it's an expensive operation and not to be done in a core game update loop. + * + * @method Phaser.Tilemap#generateCollisionData + * @param {number|string|Phaser.TilemapLayer} [layer] - The layer to operate on. If not given will default to this.currentLayer. + * @param {boolean} [addToWorld=true] - If true it will automatically add each body to the world, otherwise it's up to you to do so. + * @return {array} An array of the Phaser.Physics.Body objects that have been created. + */ + generateCollisionData: function (layer, addToWorld) { + + layer = this.getLayer(layer); + + if (typeof addToWorld === 'undefined') { addToWorld = true; } + + // If the bodies array is already populated we need to nuke it + if (this.layers[layer].bodies.length > 0) + { + this.clearPhysicsBodies(layer); + } + + this.layers[layer].bodies.length = []; + + var width = 0; + var sx = 0; + var sy = 0; + + for (var y = 0, h = this.layers[layer].height; y < h; y++) + { + width = 0; + + for (var x = 0, w = this.layers[layer].width; x < w; x++) + { + var tile = this.layers[layer].data[y][x]; + + if (tile) + { + right = this.getTileRight(layer, x, y); + + if (width === 0) + { + sx = tile.x * tile.width; + sy = tile.y * tile.height; + width = tile.width; + } + + if (right && right.collides) + { + width += tile.width; + } + else + { + var body = this.game.physics.createBody(sx, sy, 0, false); + + body.addRectangle(width, tile.height, width / 2, tile.height / 2, 0); + + if (addToWorld) + { + this.game.physics.addBody(body.data); + } + + this.layers[layer].bodies.push(body); + + width = 0; + } + } + } + } + + return this.layers[layer].bodies; + + }, + + /** + * Converts all of the polylines inside a Tiled ObjectGroup into physics bodies that are added to the world. + * Note that the polylines must be created in such a way that they can withstand polygon decomposition. + * + * @method Phaser.Tilemap#createCollisionObjects + * @param {string} [layer] - The Tiled layer to operate on that contains the collision data. + * @param {boolean} [addToWorld=true] - If true it will automatically add each body to the world. + * @return {array} An array of the Phaser.Physics.Body objects that have been created. + */ + createCollisionObjects: function (layer, addToWorld) { + + if (typeof addToWorld === 'undefined') { addToWorld = true; } + + var output = []; + + for (var i = 0, len = this.collision[layer].length; i < len; i++) + { + // name: json.layers[i].objects[v].name, + // x: json.layers[i].objects[v].x, + // y: json.layers[i].objects[v].y, + // width: json.layers[i].objects[v].width, + // height: json.layers[i].objects[v].height, + // visible: json.layers[i].objects[v].visible, + // properties: json.layers[i].objects[v].properties, + // polyline: json.layers[i].objects[v].polyline + + var object = this.collision[layer][i]; + + var body = this.game.physics.createBody(object.x, object.y, 0, addToWorld, {}, object.polyline); + + if (body) + { + output.push(body); + } + + } + + return output; + + }, + /** * 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. diff --git a/src/tilemap/TilemapParser.js b/src/tilemap/TilemapParser.js index b9f1a8eb..e325cf8c 100644 --- a/src/tilemap/TilemapParser.js +++ b/src/tilemap/TilemapParser.js @@ -89,7 +89,7 @@ Phaser.TilemapParser = { } else { - return { layers: [], objects: [], images: [], tilesets: [] }; + return this.getEmptyData(); } }, @@ -133,6 +133,58 @@ Phaser.TilemapParser = { }, + /** + * Returns an empty map data object. + * @method Phaser.TilemapParser.getEmptyData + * @return {object} Generated map data. + */ + getEmptyData: function () { + + var map = {}; + + map.width = 0; + map.height = 0; + map.tileWidth = 0; + map.tileHeight = 0; + map.orientation = 'orthogonal'; + map.version = '1'; + map.properties = {}; + map.widthInPixels = 0; + map.heightInPixels = 0; + + var layers = []; + + var layer = { + + name: 'layer', + x: 0, + y: 0, + width: 0, + height: 0, + widthInPixels: 0, + heightInPixels: 0, + alpha: 1, + visible: true, + properties: {}, + indexes: [], + callbacks: [], + data: [] + + }; + + layers.push(layer); + + map.layers = layers; + map.images = []; + map.objects = {}; + map.collision = {}; + map.tilesets = []; + map.tiles = []; + + return map; + + }, + /** * Parses a Tiled JSON file into valid map data. * @method Phaser.TilemapParser.parseJSON @@ -183,7 +235,8 @@ Phaser.TilemapParser = { visible: json.layers[i].visible, properties: {}, indexes: [], - callbacks: [] + callbacks: [], + bodies: [] }; @@ -265,8 +318,9 @@ Phaser.TilemapParser = { map.images = images; - // Objects + // Objects & Collision Data (polylines, etc) var objects = {}; + var collision = {}; for (var i = 0; i < json.layers.length; i++) { @@ -276,10 +330,11 @@ Phaser.TilemapParser = { } objects[json.layers[i].name] = []; + collision[json.layers[i].name] = []; for (var v = 0, len = json.layers[i].objects.length; v < len; v++) { - // For now we'll just support object tiles + // Object Tiles if (json.layers[i].objects[v].gid) { var object = { @@ -295,11 +350,37 @@ Phaser.TilemapParser = { objects[json.layers[i].name].push(object); } + else if (json.layers[i].objects[v].polyline) + { + var object = { + + name: json.layers[i].objects[v].name, + x: json.layers[i].objects[v].x, + y: json.layers[i].objects[v].y, + width: json.layers[i].objects[v].width, + height: json.layers[i].objects[v].height, + visible: json.layers[i].objects[v].visible, + properties: json.layers[i].objects[v].properties + + }; + + object.polyline = []; + + // Parse the polyline into an array + for (var p = 0; p < json.layers[i].objects[v].polyline.length; p++) + { + object.polyline.push([ json.layers[i].objects[v].polyline[p].x, json.layers[i].objects[v].polyline[p].y ]); + } + + collision[json.layers[i].name].push(object); + + } } } map.objects = objects; + map.collision = collision; // Tilesets var tilesets = []; diff --git a/src/utils/Debug.js b/src/utils/Debug.js index 9a1a8b9d..412dce29 100644 --- a/src/utils/Debug.js +++ b/src/utils/Debug.js @@ -717,23 +717,24 @@ Phaser.Utils.Debug.prototype = { var shapeAngles = body.data.shapeAngles; var i = shapes.length; - var x = this.game.math.p2px(body.data.position[0]); - var y = this.game.math.p2px(body.data.position[1]); + var x = this.game.math.p2px(body.data.position[0]) - this.game.camera.view.x; + var y = this.game.math.p2px(body.data.position[1]) - this.game.camera.view.y; var angle = body.data.angle; while (i--) { if (shapes[i] instanceof p2.Rectangle) { - this.renderShapeRectangle(shapes[i], x, y, angle); + this.renderShapeRectangle(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]); } else if (shapes[i] instanceof p2.Line) { - this.renderShapeLine(x, y, shapes[i], shapeOffsets[i], shapeAngles[i]); + this.renderShapeLine(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]); } - else if (shapes[i] instanceof p2.Convex) + // else if (shapes[i] instanceof p2.Convex) + else { - this.renderShapeConvex(x, y, shapes[i], shapeOffsets[i], shapeAngles[i]); + this.renderShapeConvex(x, y, angle, shapes[i], shapeOffsets[i], shapeAngles[i]); } } @@ -748,7 +749,7 @@ Phaser.Utils.Debug.prototype = { * @param {number} y - The y coordinate of the Body to translate to. * @param {number} angle - The angle of the Body to rotate to. */ - renderShapeRectangle: function (shape, x, y, angle) { + renderShapeRectangle: function (x, y, bodyAngle, shape, offset, angle) { var w = this.game.math.p2px(shape.width); var h = this.game.math.p2px(shape.height); @@ -756,9 +757,8 @@ Phaser.Utils.Debug.prototype = { this.context.beginPath(); this.context.save(); - this.context.translate(x, y); - this.context.rotate(angle); - this.context.lineWidth = 0.5; + this.context.translate(x + this.game.math.p2px(offset[0]), y + this.game.math.p2px(offset[1])); + this.context.rotate(bodyAngle + angle); this.context.moveTo(this.game.math.p2px(points[0][0]), this.game.math.p2px(points[0][1])); @@ -781,18 +781,13 @@ Phaser.Utils.Debug.prototype = { * @param {number} offset - * @param {number} angle - */ - renderShapeLine: function (x, y, shape, offset, angle) { + renderShapeLine: function (x, y, bodyAngle, shape, offset, angle) { - // var w = this.game.math.p2px(shape.width); - // var h = this.game.math.p2px(shape.height); - // var points = shape.vertices; - this.context.beginPath(); this.context.save(); this.context.translate(x, y); - this.context.rotate(angle); + this.context.rotate(bodyAngle + angle); this.context.lineWidth = 0.5; - // this.context.moveTo(this.game.math.p2px(points[0][0]), this.game.math.p2px(points[0][1])); this.context.moveTo(0, 0); this.context.lineTo(this.game.math.p2px(shape.length), 0); this.context.closePath(); @@ -808,15 +803,14 @@ Phaser.Utils.Debug.prototype = { * @param {number} y - The y coordinate of the Body to translate to. * @param {number} angle - The angle of the Body to rotate to. */ - renderShapeConvex: function (x, y, shape, offset, angle) { + renderShapeConvex: function (x, y, bodyAngle, shape, offset, angle) { var points = shape.vertices; this.context.beginPath(); this.context.save(); this.context.translate(x + this.game.math.p2px(offset[0]), y + this.game.math.p2px(offset[1])); - this.context.rotate(angle); - this.context.lineWidth = 0.5; + this.context.rotate(bodyAngle + angle); this.context.moveTo(this.game.math.p2px(points[0][0]), this.game.math.p2px(points[0][1]));