File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11var Class = require ( '../../utils/Class' ) ;
22var Components = require ( '../components' ) ;
3+ var Rectangle = require ( '../../geom/rectangle' ) ;
34
45var Tile = new Class ( {
56
@@ -312,6 +313,25 @@ var Tile = new Class({
312313 : this . getTop ( camera ) + this . height ;
313314 } ,
314315
316+
317+ /**
318+ * Gets the world rectangle bounding box for the tile, factoring in the layer's position,
319+ * scale and scroll.
320+ * @param {Camera } [camera=main camera] - [description]
321+ * @param {object } [output] - [description]
322+ * @returns {Phaser.Geom.Rectangle|object }
323+ */
324+ getBounds : function ( camera , output )
325+ {
326+ if ( output === undefined ) { output = new Rectangle ( ) ; }
327+
328+ output . x = this . getLeft ( ) ;
329+ output . y = this . getTop ( ) ;
330+ output . width = this . getRight ( ) - output . x ;
331+ output . height = this . getBottom ( ) - output . y ;
332+ return output ;
333+ } ,
334+
315335 /**
316336 * Gets the world X position of the center of the tile, factoring in the layer's position,
317337 * scale and scroll.
You can’t perform that action at this time.
0 commit comments