@@ -454,84 +454,23 @@ Phaser.TilemapLayer.prototype.getTileXY = function (x, y, point) {
454454
455455}
456456
457- Phaser . TilemapLayer . prototype . getIntersectingTiles = function ( x , y , width , height , right , bottom ) {
457+ /**
458+ * Gets all tiles that intersect with the given line.
459+ *
460+ * @method Phaser.TilemapLayer#getIntersectingTiles
461+ * @memberof Phaser.TilemapLayer
462+ * @param {Phaser.Line } line - The line used to determine which tiles to return.
463+ * @return {array<Phaser.Tile> } An array of Phaser.Tiles.
464+ */
465+ Phaser . TilemapLayer . prototype . getIntersectingTiles = function ( line ) {
458466
459467 var tiles = this . getTiles ( x , y , width , height , false ) ;
460468
461- // We only want the ones that we actually intersect with
462- var i = tiles . length ;
463-
464- while ( i -- )
465- {
466- if ( ! tiles [ i ] . intersects ( x , y , right , bottom ) )
467- {
468- tiles . pop ( ) ;
469- }
470- }
471469
472470 return tiles ;
473471
474472}
475473
476- /*
477- Phaser.TilemapLayer.prototype.getTilesX = function (x, y, width, height, collides) {
478-
479- // Should we only get tiles that have at least one of their collision flags set? (true = yes, false = no just get them all)
480- if (typeof collides === 'undefined') { collides = false; }
481-
482- // adjust the x,y coordinates for scrollFactor
483- x = this._fixX(x);
484- y = this._fixY(y);
485-
486- if (width > this.layer.widthInPixels)
487- {
488- width = this.layer.widthInPixels;
489- }
490-
491- if (height > this.layer.heightInPixels)
492- {
493- height = this.layer.heightInPixels;
494- }
495-
496- // Convert the pixel values into tile coordinates
497- // this._tx = this.game.math.snapToFloor(x, this._cw) / this._cw;
498- // this._ty = this.game.math.snapToFloor(y, this._ch) / this._ch;
499- // this._tw = (this.game.math.snapToCeil(width, this._cw) + this._cw) / this._cw;
500- // this._th = (this.game.math.snapToCeil(height, this._ch) + this._ch) / this._ch;
501-
502- // var firstTileX = Math.max( Math.floor(res.pos.x / this.tilesize), 0 );
503- // var lastTileX = Math.min( Math.ceil((res.pos.x + width) / this.tilesize), this.width );
504- // var tileY = Math.floor( (res.pos.y + pxOffsetY) / this.tilesize );
505-
506- this._tx = Math.max(Math.floor(x / this.tileWidth), 0);
507- this._tw = Math.min(Math.ceil((x + width) / this.tileWidth), this.width);
508- this._ty = Math.floor((y + px) / this.tileHeight);
509-
510- this._results.length = 0;
511-
512- for (var wy = this._ty; wy < this._ty + this._th; wy++)
513- {
514- for (var wx = this._tx; wx < this._tx + this._tw; wx++)
515- {
516- if (this.layer.data[wy] && this.layer.data[wy][wx])
517- {
518- if (collides === false || (collides && this.layer.data[wy][wx].canCollide))
519- {
520- this._results.push(this.layer.data[wy][wx]);
521- }
522- }
523- }
524- }
525-
526- // DEBUG ONLY - REMOVE
527- this.layer.dirty = true;
528-
529- return this._results;
530-
531- }
532- */
533-
534-
535474/**
536475* Get all tiles that exist within the given area, defined by the top-left corner, width and height. Values given are in pixels, not tiles.
537476* @method Phaser.TilemapLayer#getTiles
@@ -542,7 +481,7 @@ Phaser.TilemapLayer.prototype.getTilesX = function (x, y, width, height, collide
542481* @param {number } height - Height of the area to get.
543482* @param {boolean } [collides=false] - If true only return tiles that collide on one or more faces.
544483* @param {boolean } [interestingFace=false] - If true only return tiles that have interesting faces.
545- * @return {array } Array with tiles informations (each contains x, y, and the tile) .
484+ * @return {array<Phaser.Tile> } An array of Phaser.Tiles .
546485*/
547486Phaser . TilemapLayer . prototype . getTiles = function ( x , y , width , height , collides , interestingFace ) {
548487
0 commit comments