mirror of
https://github.com/photonstorm/phaser
synced 2025-01-08 19:28:57 +00:00
changed orientation to be part of the layer, really cleaned up API. Started tests on the dynamic layer. Trying to understand getTileAt bug
This commit is contained in:
parent
70cbdc0925
commit
fd29e96a5d
23 changed files with 219 additions and 212 deletions
144
dist/phaser-arcade-physics.js
vendored
144
dist/phaser-arcade-physics.js
vendored
|
@ -9810,14 +9810,13 @@ module.exports = MultiFile;
|
|||
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {number} The X location in tile units.
|
||||
*/
|
||||
var WorldToTileX = function (worldX, snapToFloor, camera, layer, orientation)
|
||||
var WorldToTileX = function (worldX, snapToFloor, camera, layer)
|
||||
{
|
||||
|
||||
|
||||
var orientation = layer.orientation;
|
||||
if (snapToFloor === undefined) { snapToFloor = true; }
|
||||
|
||||
var tileWidth = layer.baseTileWidth;
|
||||
|
@ -9869,12 +9868,12 @@ module.exports = WorldToTileX;
|
|||
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {number} The Y location in tile units.
|
||||
*/
|
||||
var WorldToTileY = function (worldY, snapToFloor, camera, layer, orientation)
|
||||
var WorldToTileY = function (worldY, snapToFloor, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
if (snapToFloor === undefined) { snapToFloor = true; }
|
||||
var tileHeight = layer.baseTileHeight;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
|
@ -12893,14 +12892,13 @@ var Tile = new Class({
|
|||
// coordinate needs to be adjusted by the difference.
|
||||
this.pixelX = this.x * this.baseWidth;
|
||||
this.pixelY = this.y * this.baseHeight;
|
||||
console.log("orthopix "+this.pixelX+","+this.pixelY)
|
||||
// console.log("orthopix "+this.pixelX+","+this.pixelY)
|
||||
} else if (this.layer.orientation === "isometric" ) {
|
||||
// for the image to be centered we have to move the image to the right with the camera !
|
||||
// this is crucial for wordtotile, tiletoworld to work.
|
||||
this.pixelX = (this.x - this.y) * this.baseWidth *0.5;
|
||||
this.pixelY = (this.x + this.y) * this.baseHeight *0.5;
|
||||
console.log("isopix "+this.pixelX+","+this.pixelY)
|
||||
console.log(this)
|
||||
// console.log("isopix "+this.pixelX+","+this.pixelY)
|
||||
} else {
|
||||
console.warn("this map orientation is not supported in this version of phaser")
|
||||
console.log("tile orientation 3: "+this.layer.orientation)
|
||||
|
@ -19498,6 +19496,16 @@ var LayerData = new Class({
|
|||
*/
|
||||
this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight);
|
||||
|
||||
/**
|
||||
* The layer's orientation, necessary to be able to determine q tile's pixelX and pixelY as well as the layer's width and height.
|
||||
*
|
||||
* @name Phaser.Tilemaps.LayerData#orientation
|
||||
* @type {string}
|
||||
* @since 3.22.PR_svipal
|
||||
*/
|
||||
this.orientation = GetFastValue(config, 'orientation', "orthogonal");
|
||||
|
||||
|
||||
/**
|
||||
* The width in pixels of the entire layer.
|
||||
*
|
||||
|
@ -19597,14 +19605,7 @@ var LayerData = new Class({
|
|||
*/
|
||||
this.tilemapLayer = GetFastValue(config, 'tilemapLayer', null);
|
||||
|
||||
/**
|
||||
* The layer's orientation, necessary to be able to determine pixelX and pixelY.
|
||||
*
|
||||
* @name Phaser.Tilemaps.LayerData#orientation
|
||||
* @type {string}
|
||||
* @since 3.2.PR_svipal
|
||||
*/
|
||||
this.orientation = GetFastValue(config, 'orientation', "orthogonal");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -26609,19 +26610,23 @@ var GetTileAt = function (tileX, tileY, nonNull, layer)
|
|||
|
||||
if (IsInLayerBounds(tileX, tileY, layer))
|
||||
{
|
||||
console.log("tile in bounds", tileX, tileY)
|
||||
var tile = layer.data[tileY][tileX] || null;
|
||||
if (tile === null)
|
||||
{
|
||||
console.log("null tile", tileX, tileY)
|
||||
return null;
|
||||
}
|
||||
else if (tile.index === -1)
|
||||
{
|
||||
console.log("null tile", tileX, tileY)
|
||||
return nonNull ? tile : null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return tile;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -26653,12 +26658,12 @@ module.exports = GetTileAt;
|
|||
* @param {integer} tileX - The x coordinate, in tiles, not pixels.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
var TileToWorldX = function (tileX, camera, layer, orientation)
|
||||
var TileToWorldX = function (tileX, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
var tileWidth = layer.baseTileWidth;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
var layerWorldX = 0;
|
||||
|
@ -26708,12 +26713,12 @@ module.exports = TileToWorldX;
|
|||
* @param {integer} tileY - The x coordinate, in tiles, not pixels.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
var TileToWorldY = function (tileY, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
var tileHeight = layer.baseTileHeight;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
var layerWorldY = 0;
|
||||
|
@ -47381,11 +47386,10 @@ var SetTileCollision = __webpack_require__(74);
|
|||
* @param {integer} tileY - The y coordinate, in tiles, not pixels.
|
||||
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map.
|
||||
*/
|
||||
var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer, orientation)
|
||||
var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer)
|
||||
{
|
||||
if (!IsInLayerBounds(tileX, tileY, layer)) { return null; }
|
||||
if (recalculateFaces === undefined) { recalculateFaces = true; }
|
||||
|
@ -47397,7 +47401,7 @@ var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer, orientati
|
|||
{
|
||||
if (layer.data[tileY][tileX] === null)
|
||||
{
|
||||
layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height, orientation);
|
||||
layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height);
|
||||
}
|
||||
layer.data[tileY][tileX].copy(tile);
|
||||
}
|
||||
|
@ -107485,7 +107489,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
getTilesWithinShape: function (shape, filteringOptions, camera)
|
||||
{
|
||||
return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -107505,7 +107509,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera)
|
||||
{
|
||||
return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -107561,7 +107565,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
putTileAt: function (tile, tileX, tileY, recalculateFaces)
|
||||
{
|
||||
return TilemapComponents.PutTileAt(tile, tileX, tileY, recalculateFaces, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.PutTileAt(tile, tileX, tileY, recalculateFaces, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -107583,7 +107587,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
putTileAtWorldXY: function (tile, worldX, worldY, recalculateFaces, camera)
|
||||
{
|
||||
return TilemapComponents.PutTileAtWorldXY(tile, worldX, worldY, recalculateFaces, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.PutTileAtWorldXY(tile, worldX, worldY, recalculateFaces, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -107605,7 +107609,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
putTilesAt: function (tilesArray, tileX, tileY, recalculateFaces)
|
||||
{
|
||||
TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, this.layer, this.tilemap.orientation);
|
||||
TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -107671,7 +107675,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, recalculateFaces, camera)
|
||||
{
|
||||
return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, recalculateFaces, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, recalculateFaces, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -107989,7 +107993,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
tileToWorldX: function (tileX, camera)
|
||||
{
|
||||
return TilemapComponents.TileToWorldX(tileX, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.TileToWorldX(tileX, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -108006,7 +108010,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
tileToWorldY: function (tileY, camera)
|
||||
{
|
||||
return TilemapComponents.TileToWorldY(tileY, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.TileToWorldY(tileY, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -108026,7 +108030,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
tileToWorldXY: function (tileX, tileY, point, camera)
|
||||
{
|
||||
return TilemapComponents.TileToWorldXY(tileX, tileY, point, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.TileToWorldXY(tileX, tileY, point, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -108079,7 +108083,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileX: function (worldX, snapToFloor, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -108097,7 +108101,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileY: function (worldY, snapToFloor, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -108118,7 +108122,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileXY: function (worldX, worldY, snapToFloor, point, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -109203,7 +109207,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera)
|
||||
{
|
||||
return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -109221,7 +109225,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
getTilesWithinShape: function (shape, filteringOptions, camera)
|
||||
{
|
||||
return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -109257,7 +109261,7 @@ var StaticTilemapLayer = new Class({
|
|||
hasTileAtWorldXY: function (worldX, worldY, camera)
|
||||
{
|
||||
|
||||
return TilemapComponents.HasTileAtWorldXY(worldX, worldY, camera, this.tilemap.orientation);
|
||||
return TilemapComponents.HasTileAtWorldXY(worldX, worldY, camera);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -109524,7 +109528,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileX: function (worldX, snapToFloor, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -109543,7 +109547,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileY: function (worldY, snapToFloor, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -109565,7 +109569,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileXY: function (worldX, worldY, snapToFloor, point, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -175172,9 +175176,9 @@ var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, came
|
|||
|
||||
if (indexes.indexOf(tile.index) !== -1)
|
||||
{
|
||||
spriteConfig.x = TileToWorldX(tile.x, camera, layer);
|
||||
spriteConfig.y = TileToWorldY(tile.y, camera, layer);
|
||||
|
||||
var point = TileToWorldXY(tile.x,tile.y, camera, layer)
|
||||
spriteConfig.x = point.x;
|
||||
spriteConfig.y = point.y;
|
||||
var sprite = scene.make.sprite(spriteConfig);
|
||||
sprites.push(sprite);
|
||||
}
|
||||
|
@ -175686,9 +175690,9 @@ var WorldToTileY = __webpack_require__(64);
|
|||
*/
|
||||
var GetTileAtWorldXY = function (worldX, worldY, nonNull, camera, layer)
|
||||
{
|
||||
var tileX = WorldToTileX(worldX, true, camera, layer);
|
||||
var tileY = WorldToTileY(worldY, true, camera, layer);
|
||||
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
||||
var tileX = point.x
|
||||
var tileY = point.y
|
||||
return GetTileAt(tileX, tileY, nonNull, layer);
|
||||
};
|
||||
|
||||
|
@ -175737,12 +175741,12 @@ var TriangleToRectangle = function (triangle, rect)
|
|||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.
|
||||
*/
|
||||
var GetTilesWithinShape = function (shape, filteringOptions, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
if (shape === undefined) { return []; }
|
||||
|
||||
// intersectTest is a function with parameters: shape, rect
|
||||
|
@ -175826,12 +175830,12 @@ var WorldToTileY = __webpack_require__(64);
|
|||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.
|
||||
*/
|
||||
var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer, orientation)
|
||||
var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation
|
||||
// Top left corner of the rect, rounded down to include partial tiles
|
||||
var pointStart = WorldToTileXY(worldX, worldY, true, camera, layer, orientation);
|
||||
var xStart = pointStart.x;
|
||||
|
@ -175877,12 +175881,11 @@ var WorldToTileY = __webpack_require__(64);
|
|||
*
|
||||
* @return {?boolean} Returns a boolean, or null if the layer given was invalid.
|
||||
*/
|
||||
var HasTileAtWorldXY = function (worldX, worldY, camera, orientation)
|
||||
var HasTileAtWorldXY = function (worldX, worldY, camera, layer)
|
||||
{
|
||||
var layer = stlayer.layer
|
||||
var tileX = WorldToTileX(worldX, true, camera, layer, orientation);
|
||||
var tileY = WorldToTileY(worldY, true, camera, layer, orientation);
|
||||
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
||||
var tileX = point.x;
|
||||
var tileY = point.y;
|
||||
return HasTileAt(tileX, tileY, layer);
|
||||
};
|
||||
|
||||
|
@ -175919,13 +175922,13 @@ var WorldToTileY = __webpack_require__(64);
|
|||
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map.
|
||||
*/
|
||||
var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer, orientation)
|
||||
var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer)
|
||||
{
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer, orientation);
|
||||
var orientation = layer.orientation
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
||||
var tileX = point.x
|
||||
var tileY = point.y
|
||||
return PutTileAt(tile, tileX, tileY, recalculateFaces, layer);
|
||||
|
@ -175963,10 +175966,9 @@ var PutTileAt = __webpack_require__(220);
|
|||
* @param {integer} tileY - The y coordinate, in tiles, not pixels.
|
||||
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*/
|
||||
var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer, orientation)
|
||||
var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer)
|
||||
{
|
||||
if (!Array.isArray(tilesArray)) { return null; }
|
||||
if (recalculateFaces === undefined) { recalculateFaces = true; }
|
||||
|
@ -175985,7 +175987,7 @@ var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer, or
|
|||
for (var tx = 0; tx < width; tx++)
|
||||
{
|
||||
var tile = tilesArray[ty][tx];
|
||||
PutTileAt(tile, tileX + tx, tileY + ty, false, layer, orientation);
|
||||
PutTileAt(tile, tileX + tx, tileY + ty, false, layer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176086,13 +176088,13 @@ var WorldToTileY = __webpack_require__(64);
|
|||
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was removed.
|
||||
*/
|
||||
var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer,orientation)
|
||||
var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer)
|
||||
{
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer, orientation);
|
||||
var orientation = layer.orientation
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
||||
var tileX = point.x
|
||||
var tileY = point.y
|
||||
return RemoveTileAt(tileX, tileY, replaceWithNull, recalculateFaces, layer);
|
||||
|
@ -176740,12 +176742,12 @@ var Vector2 = __webpack_require__(3);
|
|||
* @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*
|
||||
* @return {Phaser.Math.Vector2} The XY location in world coordinates.
|
||||
*/
|
||||
var TileToWorldXY = function (tileX, tileY, point, camera, layer, orientation)
|
||||
var TileToWorldXY = function (tileX, tileY, point, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
var tileWidth = layer.baseTileWidth;
|
||||
var tileHeight = layer.baseTileHeight;
|
||||
|
||||
|
@ -176875,12 +176877,12 @@ var Vector2 = __webpack_require__(3);
|
|||
* @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*
|
||||
* @return {Phaser.Math.Vector2} The XY location in tile units.
|
||||
*/
|
||||
var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer,orientation)
|
||||
var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
if (point === undefined) { point = new Vector2(0, 0); }
|
||||
|
||||
if (orientation === "orthogonal") {
|
||||
|
|
2
dist/phaser-arcade-physics.min.js
vendored
2
dist/phaser-arcade-physics.min.js
vendored
File diff suppressed because one or more lines are too long
144
dist/phaser.js
vendored
144
dist/phaser.js
vendored
|
@ -11734,14 +11734,13 @@ var Axes = __webpack_require__(512);
|
|||
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {number} The X location in tile units.
|
||||
*/
|
||||
var WorldToTileX = function (worldX, snapToFloor, camera, layer, orientation)
|
||||
var WorldToTileX = function (worldX, snapToFloor, camera, layer)
|
||||
{
|
||||
|
||||
|
||||
var orientation = layer.orientation;
|
||||
if (snapToFloor === undefined) { snapToFloor = true; }
|
||||
|
||||
var tileWidth = layer.baseTileWidth;
|
||||
|
@ -11793,12 +11792,12 @@ module.exports = WorldToTileX;
|
|||
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {number} The Y location in tile units.
|
||||
*/
|
||||
var WorldToTileY = function (worldY, snapToFloor, camera, layer, orientation)
|
||||
var WorldToTileY = function (worldY, snapToFloor, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
if (snapToFloor === undefined) { snapToFloor = true; }
|
||||
var tileHeight = layer.baseTileHeight;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
|
@ -14817,14 +14816,13 @@ var Tile = new Class({
|
|||
// coordinate needs to be adjusted by the difference.
|
||||
this.pixelX = this.x * this.baseWidth;
|
||||
this.pixelY = this.y * this.baseHeight;
|
||||
console.log("orthopix "+this.pixelX+","+this.pixelY)
|
||||
// console.log("orthopix "+this.pixelX+","+this.pixelY)
|
||||
} else if (this.layer.orientation === "isometric" ) {
|
||||
// for the image to be centered we have to move the image to the right with the camera !
|
||||
// this is crucial for wordtotile, tiletoworld to work.
|
||||
this.pixelX = (this.x - this.y) * this.baseWidth *0.5;
|
||||
this.pixelY = (this.x + this.y) * this.baseHeight *0.5;
|
||||
console.log("isopix "+this.pixelX+","+this.pixelY)
|
||||
console.log(this)
|
||||
// console.log("isopix "+this.pixelX+","+this.pixelY)
|
||||
} else {
|
||||
console.warn("this map orientation is not supported in this version of phaser")
|
||||
console.log("tile orientation 3: "+this.layer.orientation)
|
||||
|
@ -22250,6 +22248,16 @@ var LayerData = new Class({
|
|||
*/
|
||||
this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight);
|
||||
|
||||
/**
|
||||
* The layer's orientation, necessary to be able to determine q tile's pixelX and pixelY as well as the layer's width and height.
|
||||
*
|
||||
* @name Phaser.Tilemaps.LayerData#orientation
|
||||
* @type {string}
|
||||
* @since 3.22.PR_svipal
|
||||
*/
|
||||
this.orientation = GetFastValue(config, 'orientation', "orthogonal");
|
||||
|
||||
|
||||
/**
|
||||
* The width in pixels of the entire layer.
|
||||
*
|
||||
|
@ -22349,14 +22357,7 @@ var LayerData = new Class({
|
|||
*/
|
||||
this.tilemapLayer = GetFastValue(config, 'tilemapLayer', null);
|
||||
|
||||
/**
|
||||
* The layer's orientation, necessary to be able to determine pixelX and pixelY.
|
||||
*
|
||||
* @name Phaser.Tilemaps.LayerData#orientation
|
||||
* @type {string}
|
||||
* @since 3.2.PR_svipal
|
||||
*/
|
||||
this.orientation = GetFastValue(config, 'orientation', "orthogonal");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -29718,19 +29719,23 @@ var GetTileAt = function (tileX, tileY, nonNull, layer)
|
|||
|
||||
if (IsInLayerBounds(tileX, tileY, layer))
|
||||
{
|
||||
console.log("tile in bounds", tileX, tileY)
|
||||
var tile = layer.data[tileY][tileX] || null;
|
||||
if (tile === null)
|
||||
{
|
||||
console.log("null tile", tileX, tileY)
|
||||
return null;
|
||||
}
|
||||
else if (tile.index === -1)
|
||||
{
|
||||
console.log("null tile", tileX, tileY)
|
||||
return nonNull ? tile : null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return tile;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -29762,12 +29767,12 @@ module.exports = GetTileAt;
|
|||
* @param {integer} tileX - The x coordinate, in tiles, not pixels.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
var TileToWorldX = function (tileX, camera, layer, orientation)
|
||||
var TileToWorldX = function (tileX, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
var tileWidth = layer.baseTileWidth;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
var layerWorldX = 0;
|
||||
|
@ -29817,12 +29822,12 @@ module.exports = TileToWorldX;
|
|||
* @param {integer} tileY - The x coordinate, in tiles, not pixels.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
var TileToWorldY = function (tileY, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
var tileHeight = layer.baseTileHeight;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
var layerWorldY = 0;
|
||||
|
@ -51671,11 +51676,10 @@ var SetTileCollision = __webpack_require__(74);
|
|||
* @param {integer} tileY - The y coordinate, in tiles, not pixels.
|
||||
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map.
|
||||
*/
|
||||
var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer, orientation)
|
||||
var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer)
|
||||
{
|
||||
if (!IsInLayerBounds(tileX, tileY, layer)) { return null; }
|
||||
if (recalculateFaces === undefined) { recalculateFaces = true; }
|
||||
|
@ -51687,7 +51691,7 @@ var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer, orientati
|
|||
{
|
||||
if (layer.data[tileY][tileX] === null)
|
||||
{
|
||||
layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height, orientation);
|
||||
layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height);
|
||||
}
|
||||
layer.data[tileY][tileX].copy(tile);
|
||||
}
|
||||
|
@ -112296,7 +112300,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
getTilesWithinShape: function (shape, filteringOptions, camera)
|
||||
{
|
||||
return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -112316,7 +112320,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera)
|
||||
{
|
||||
return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -112372,7 +112376,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
putTileAt: function (tile, tileX, tileY, recalculateFaces)
|
||||
{
|
||||
return TilemapComponents.PutTileAt(tile, tileX, tileY, recalculateFaces, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.PutTileAt(tile, tileX, tileY, recalculateFaces, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -112394,7 +112398,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
putTileAtWorldXY: function (tile, worldX, worldY, recalculateFaces, camera)
|
||||
{
|
||||
return TilemapComponents.PutTileAtWorldXY(tile, worldX, worldY, recalculateFaces, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.PutTileAtWorldXY(tile, worldX, worldY, recalculateFaces, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -112416,7 +112420,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
putTilesAt: function (tilesArray, tileX, tileY, recalculateFaces)
|
||||
{
|
||||
TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, this.layer, this.tilemap.orientation);
|
||||
TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -112482,7 +112486,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, recalculateFaces, camera)
|
||||
{
|
||||
return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, recalculateFaces, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, recalculateFaces, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -112800,7 +112804,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
tileToWorldX: function (tileX, camera)
|
||||
{
|
||||
return TilemapComponents.TileToWorldX(tileX, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.TileToWorldX(tileX, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -112817,7 +112821,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
tileToWorldY: function (tileY, camera)
|
||||
{
|
||||
return TilemapComponents.TileToWorldY(tileY, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.TileToWorldY(tileY, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -112837,7 +112841,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
tileToWorldXY: function (tileX, tileY, point, camera)
|
||||
{
|
||||
return TilemapComponents.TileToWorldXY(tileX, tileY, point, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.TileToWorldXY(tileX, tileY, point, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -112890,7 +112894,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileX: function (worldX, snapToFloor, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -112908,7 +112912,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileY: function (worldY, snapToFloor, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -112929,7 +112933,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileXY: function (worldX, worldY, snapToFloor, point, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -114014,7 +114018,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera)
|
||||
{
|
||||
return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -114032,7 +114036,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
getTilesWithinShape: function (shape, filteringOptions, camera)
|
||||
{
|
||||
return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -114068,7 +114072,7 @@ var StaticTilemapLayer = new Class({
|
|||
hasTileAtWorldXY: function (worldX, worldY, camera)
|
||||
{
|
||||
|
||||
return TilemapComponents.HasTileAtWorldXY(worldX, worldY, camera, this.tilemap.orientation);
|
||||
return TilemapComponents.HasTileAtWorldXY(worldX, worldY, camera);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -114335,7 +114339,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileX: function (worldX, snapToFloor, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -114354,7 +114358,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileY: function (worldY, snapToFloor, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -114376,7 +114380,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileXY: function (worldX, worldY, snapToFloor, point, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -183098,9 +183102,9 @@ var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, came
|
|||
|
||||
if (indexes.indexOf(tile.index) !== -1)
|
||||
{
|
||||
spriteConfig.x = TileToWorldX(tile.x, camera, layer);
|
||||
spriteConfig.y = TileToWorldY(tile.y, camera, layer);
|
||||
|
||||
var point = TileToWorldXY(tile.x,tile.y, camera, layer)
|
||||
spriteConfig.x = point.x;
|
||||
spriteConfig.y = point.y;
|
||||
var sprite = scene.make.sprite(spriteConfig);
|
||||
sprites.push(sprite);
|
||||
}
|
||||
|
@ -183612,9 +183616,9 @@ var WorldToTileY = __webpack_require__(64);
|
|||
*/
|
||||
var GetTileAtWorldXY = function (worldX, worldY, nonNull, camera, layer)
|
||||
{
|
||||
var tileX = WorldToTileX(worldX, true, camera, layer);
|
||||
var tileY = WorldToTileY(worldY, true, camera, layer);
|
||||
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
||||
var tileX = point.x
|
||||
var tileY = point.y
|
||||
return GetTileAt(tileX, tileY, nonNull, layer);
|
||||
};
|
||||
|
||||
|
@ -183663,12 +183667,12 @@ var TriangleToRectangle = function (triangle, rect)
|
|||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.
|
||||
*/
|
||||
var GetTilesWithinShape = function (shape, filteringOptions, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
if (shape === undefined) { return []; }
|
||||
|
||||
// intersectTest is a function with parameters: shape, rect
|
||||
|
@ -183752,12 +183756,12 @@ var WorldToTileY = __webpack_require__(64);
|
|||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.
|
||||
*/
|
||||
var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer, orientation)
|
||||
var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation
|
||||
// Top left corner of the rect, rounded down to include partial tiles
|
||||
var pointStart = WorldToTileXY(worldX, worldY, true, camera, layer, orientation);
|
||||
var xStart = pointStart.x;
|
||||
|
@ -183803,12 +183807,11 @@ var WorldToTileY = __webpack_require__(64);
|
|||
*
|
||||
* @return {?boolean} Returns a boolean, or null if the layer given was invalid.
|
||||
*/
|
||||
var HasTileAtWorldXY = function (worldX, worldY, camera, orientation)
|
||||
var HasTileAtWorldXY = function (worldX, worldY, camera, layer)
|
||||
{
|
||||
var layer = stlayer.layer
|
||||
var tileX = WorldToTileX(worldX, true, camera, layer, orientation);
|
||||
var tileY = WorldToTileY(worldY, true, camera, layer, orientation);
|
||||
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
||||
var tileX = point.x;
|
||||
var tileY = point.y;
|
||||
return HasTileAt(tileX, tileY, layer);
|
||||
};
|
||||
|
||||
|
@ -183845,13 +183848,13 @@ var WorldToTileY = __webpack_require__(64);
|
|||
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map.
|
||||
*/
|
||||
var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer, orientation)
|
||||
var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer)
|
||||
{
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer, orientation);
|
||||
var orientation = layer.orientation
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
||||
var tileX = point.x
|
||||
var tileY = point.y
|
||||
return PutTileAt(tile, tileX, tileY, recalculateFaces, layer);
|
||||
|
@ -183889,10 +183892,9 @@ var PutTileAt = __webpack_require__(220);
|
|||
* @param {integer} tileY - The y coordinate, in tiles, not pixels.
|
||||
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*/
|
||||
var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer, orientation)
|
||||
var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer)
|
||||
{
|
||||
if (!Array.isArray(tilesArray)) { return null; }
|
||||
if (recalculateFaces === undefined) { recalculateFaces = true; }
|
||||
|
@ -183911,7 +183913,7 @@ var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer, or
|
|||
for (var tx = 0; tx < width; tx++)
|
||||
{
|
||||
var tile = tilesArray[ty][tx];
|
||||
PutTileAt(tile, tileX + tx, tileY + ty, false, layer, orientation);
|
||||
PutTileAt(tile, tileX + tx, tileY + ty, false, layer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184012,13 +184014,13 @@ var WorldToTileY = __webpack_require__(64);
|
|||
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was removed.
|
||||
*/
|
||||
var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer,orientation)
|
||||
var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer)
|
||||
{
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer, orientation);
|
||||
var orientation = layer.orientation
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
||||
var tileX = point.x
|
||||
var tileY = point.y
|
||||
return RemoveTileAt(tileX, tileY, replaceWithNull, recalculateFaces, layer);
|
||||
|
@ -184666,12 +184668,12 @@ var Vector2 = __webpack_require__(3);
|
|||
* @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*
|
||||
* @return {Phaser.Math.Vector2} The XY location in world coordinates.
|
||||
*/
|
||||
var TileToWorldXY = function (tileX, tileY, point, camera, layer, orientation)
|
||||
var TileToWorldXY = function (tileX, tileY, point, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
var tileWidth = layer.baseTileWidth;
|
||||
var tileHeight = layer.baseTileHeight;
|
||||
|
||||
|
@ -184801,12 +184803,12 @@ var Vector2 = __webpack_require__(3);
|
|||
* @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*
|
||||
* @return {Phaser.Math.Vector2} The XY location in tile units.
|
||||
*/
|
||||
var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer,orientation)
|
||||
var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
if (point === undefined) { point = new Vector2(0, 0); }
|
||||
|
||||
if (orientation === "orthogonal") {
|
||||
|
|
2
dist/phaser.min.js
vendored
2
dist/phaser.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -48,9 +48,9 @@ var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, came
|
|||
|
||||
if (indexes.indexOf(tile.index) !== -1)
|
||||
{
|
||||
spriteConfig.x = TileToWorldX(tile.x, camera, layer);
|
||||
spriteConfig.y = TileToWorldY(tile.y, camera, layer);
|
||||
|
||||
var point = TileToWorldXY(tile.x,tile.y, camera, layer)
|
||||
spriteConfig.x = point.x;
|
||||
spriteConfig.y = point.y;
|
||||
var sprite = scene.make.sprite(spriteConfig);
|
||||
sprites.push(sprite);
|
||||
}
|
||||
|
|
|
@ -27,19 +27,23 @@ var GetTileAt = function (tileX, tileY, nonNull, layer)
|
|||
|
||||
if (IsInLayerBounds(tileX, tileY, layer))
|
||||
{
|
||||
console.log("tile in bounds", tileX, tileY)
|
||||
var tile = layer.data[tileY][tileX] || null;
|
||||
if (tile === null)
|
||||
{
|
||||
console.log("null tile", tileX, tileY)
|
||||
return null;
|
||||
}
|
||||
else if (tile.index === -1)
|
||||
{
|
||||
console.log("null tile", tileX, tileY)
|
||||
return nonNull ? tile : null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return tile;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -26,9 +26,9 @@ var WorldToTileY = require('./WorldToTileY');
|
|||
*/
|
||||
var GetTileAtWorldXY = function (worldX, worldY, nonNull, camera, layer)
|
||||
{
|
||||
var tileX = WorldToTileX(worldX, true, camera, layer);
|
||||
var tileY = WorldToTileY(worldY, true, camera, layer);
|
||||
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
||||
var tileX = point.x
|
||||
var tileY = point.y
|
||||
return GetTileAt(tileX, tileY, nonNull, layer);
|
||||
};
|
||||
|
||||
|
|
|
@ -36,12 +36,12 @@ var TriangleToRectangle = function (triangle, rect)
|
|||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.
|
||||
*/
|
||||
var GetTilesWithinShape = function (shape, filteringOptions, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
if (shape === undefined) { return []; }
|
||||
|
||||
// intersectTest is a function with parameters: shape, rect
|
||||
|
|
|
@ -25,12 +25,12 @@ var WorldToTileY = require('./WorldToTileY');
|
|||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that have at least one interesting face.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when factoring in which tiles to return.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.
|
||||
*/
|
||||
var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer, orientation)
|
||||
var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation
|
||||
// Top left corner of the rect, rounded down to include partial tiles
|
||||
var pointStart = WorldToTileXY(worldX, worldY, true, camera, layer, orientation);
|
||||
var xStart = pointStart.x;
|
||||
|
|
|
@ -23,12 +23,11 @@ var WorldToTileY = require('./WorldToTileY');
|
|||
*
|
||||
* @return {?boolean} Returns a boolean, or null if the layer given was invalid.
|
||||
*/
|
||||
var HasTileAtWorldXY = function (worldX, worldY, camera, orientation)
|
||||
var HasTileAtWorldXY = function (worldX, worldY, camera, layer)
|
||||
{
|
||||
var layer = stlayer.layer
|
||||
var tileX = WorldToTileX(worldX, true, camera, layer, orientation);
|
||||
var tileY = WorldToTileY(worldY, true, camera, layer, orientation);
|
||||
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
||||
var tileX = point.x;
|
||||
var tileY = point.y;
|
||||
return HasTileAt(tileX, tileY, layer);
|
||||
};
|
||||
|
||||
|
|
|
@ -24,11 +24,10 @@ var SetTileCollision = require('./SetTileCollision');
|
|||
* @param {integer} tileY - The y coordinate, in tiles, not pixels.
|
||||
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map.
|
||||
*/
|
||||
var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer, orientation)
|
||||
var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer)
|
||||
{
|
||||
if (!IsInLayerBounds(tileX, tileY, layer)) { return null; }
|
||||
if (recalculateFaces === undefined) { recalculateFaces = true; }
|
||||
|
@ -40,7 +39,7 @@ var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer, orientati
|
|||
{
|
||||
if (layer.data[tileY][tileX] === null)
|
||||
{
|
||||
layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height, orientation);
|
||||
layer.data[tileY][tileX] = new Tile(layer, tile.index, tileX, tileY, tile.width, tile.height);
|
||||
}
|
||||
layer.data[tileY][tileX].copy(tile);
|
||||
}
|
||||
|
|
|
@ -24,13 +24,13 @@ var WorldToTileY = require('./WorldToTileY');
|
|||
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map.
|
||||
*/
|
||||
var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer, orientation)
|
||||
var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer)
|
||||
{
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer, orientation);
|
||||
var orientation = layer.orientation
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
||||
var tileX = point.x
|
||||
var tileY = point.y
|
||||
return PutTileAt(tile, tileX, tileY, recalculateFaces, layer);
|
||||
|
|
|
@ -23,10 +23,9 @@ var PutTileAt = require('./PutTileAt');
|
|||
* @param {integer} tileY - The y coordinate, in tiles, not pixels.
|
||||
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*/
|
||||
var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer, orientation)
|
||||
var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer)
|
||||
{
|
||||
if (!Array.isArray(tilesArray)) { return null; }
|
||||
if (recalculateFaces === undefined) { recalculateFaces = true; }
|
||||
|
@ -45,7 +44,7 @@ var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer, or
|
|||
for (var tx = 0; tx < width; tx++)
|
||||
{
|
||||
var tile = tilesArray[ty][tx];
|
||||
PutTileAt(tile, tileX + tx, tileY + ty, false, layer, orientation);
|
||||
PutTileAt(tile, tileX + tx, tileY + ty, false, layer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,13 +22,13 @@ var WorldToTileY = require('./WorldToTileY');
|
|||
* @param {boolean} [recalculateFaces=true] - `true` if the faces data should be recalculated.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was removed.
|
||||
*/
|
||||
var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer,orientation)
|
||||
var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer)
|
||||
{
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer, orientation);
|
||||
var orientation = layer.orientation
|
||||
var point = WorldToTileXY(worldX, worldY, true, camera, layer);
|
||||
var tileX = point.x
|
||||
var tileY = point.y
|
||||
return RemoveTileAt(tileX, tileY, replaceWithNull, recalculateFaces, layer);
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
* @param {integer} tileX - The x coordinate, in tiles, not pixels.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
var TileToWorldX = function (tileX, camera, layer, orientation)
|
||||
var TileToWorldX = function (tileX, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
var tileWidth = layer.baseTileWidth;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
var layerWorldX = 0;
|
||||
|
|
|
@ -22,12 +22,12 @@ var Vector2 = require('../../math/Vector2');
|
|||
* @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*
|
||||
* @return {Phaser.Math.Vector2} The XY location in world coordinates.
|
||||
*/
|
||||
var TileToWorldXY = function (tileX, tileY, point, camera, layer, orientation)
|
||||
var TileToWorldXY = function (tileX, tileY, point, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
var tileWidth = layer.baseTileWidth;
|
||||
var tileHeight = layer.baseTileHeight;
|
||||
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
* @param {integer} tileY - The x coordinate, in tiles, not pixels.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
var TileToWorldY = function (tileY, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
var tileHeight = layer.baseTileHeight;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
var layerWorldY = 0;
|
||||
|
|
|
@ -16,14 +16,13 @@
|
|||
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {number} The X location in tile units.
|
||||
*/
|
||||
var WorldToTileX = function (worldX, snapToFloor, camera, layer, orientation)
|
||||
var WorldToTileX = function (worldX, snapToFloor, camera, layer)
|
||||
{
|
||||
|
||||
|
||||
var orientation = layer.orientation;
|
||||
if (snapToFloor === undefined) { snapToFloor = true; }
|
||||
|
||||
var tileWidth = layer.baseTileWidth;
|
||||
|
|
|
@ -23,12 +23,12 @@ var Vector2 = require('../../math/Vector2');
|
|||
* @param {Phaser.Math.Vector2} [point] - A Vector2 to store the coordinates in. If not given a new Vector2 is created.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
*
|
||||
* @return {Phaser.Math.Vector2} The XY location in tile units.
|
||||
*/
|
||||
var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer,orientation)
|
||||
var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
if (point === undefined) { point = new Vector2(0, 0); }
|
||||
|
||||
if (orientation === "orthogonal") {
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the nearest integer.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when calculating the tile index from the world values.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to act upon.
|
||||
* @param {string} orientation - The Tilemap's orientation
|
||||
*
|
||||
* @return {number} The Y location in tile units.
|
||||
*/
|
||||
var WorldToTileY = function (worldY, snapToFloor, camera, layer, orientation)
|
||||
var WorldToTileY = function (worldY, snapToFloor, camera, layer)
|
||||
{
|
||||
var orientation = layer.orientation;
|
||||
if (snapToFloor === undefined) { snapToFloor = true; }
|
||||
var tileHeight = layer.baseTileHeight;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
|
|
|
@ -674,7 +674,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
getTilesWithinShape: function (shape, filteringOptions, camera)
|
||||
{
|
||||
return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -694,7 +694,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera)
|
||||
{
|
||||
return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -750,7 +750,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
putTileAt: function (tile, tileX, tileY, recalculateFaces)
|
||||
{
|
||||
return TilemapComponents.PutTileAt(tile, tileX, tileY, recalculateFaces, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.PutTileAt(tile, tileX, tileY, recalculateFaces, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -772,7 +772,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
putTileAtWorldXY: function (tile, worldX, worldY, recalculateFaces, camera)
|
||||
{
|
||||
return TilemapComponents.PutTileAtWorldXY(tile, worldX, worldY, recalculateFaces, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.PutTileAtWorldXY(tile, worldX, worldY, recalculateFaces, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -794,7 +794,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
putTilesAt: function (tilesArray, tileX, tileY, recalculateFaces)
|
||||
{
|
||||
TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, this.layer, this.tilemap.orientation);
|
||||
TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -860,7 +860,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, recalculateFaces, camera)
|
||||
{
|
||||
return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, recalculateFaces, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.RemoveTileAtWorldXY(worldX, worldY, replaceWithNull, recalculateFaces, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1178,7 +1178,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
tileToWorldX: function (tileX, camera)
|
||||
{
|
||||
return TilemapComponents.TileToWorldX(tileX, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.TileToWorldX(tileX, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1195,7 +1195,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
tileToWorldY: function (tileY, camera)
|
||||
{
|
||||
return TilemapComponents.TileToWorldY(tileY, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.TileToWorldY(tileY, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1215,7 +1215,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
tileToWorldXY: function (tileX, tileY, point, camera)
|
||||
{
|
||||
return TilemapComponents.TileToWorldXY(tileX, tileY, point, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.TileToWorldXY(tileX, tileY, point, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1268,7 +1268,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileX: function (worldX, snapToFloor, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1286,7 +1286,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileY: function (worldY, snapToFloor, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1307,7 +1307,7 @@ var DynamicTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileXY: function (worldX, worldY, snapToFloor, point, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -109,6 +109,16 @@ var LayerData = new Class({
|
|||
*/
|
||||
this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight);
|
||||
|
||||
/**
|
||||
* The layer's orientation, necessary to be able to determine q tile's pixelX and pixelY as well as the layer's width and height.
|
||||
*
|
||||
* @name Phaser.Tilemaps.LayerData#orientation
|
||||
* @type {string}
|
||||
* @since 3.22.PR_svipal
|
||||
*/
|
||||
this.orientation = GetFastValue(config, 'orientation', "orthogonal");
|
||||
|
||||
|
||||
/**
|
||||
* The width in pixels of the entire layer.
|
||||
*
|
||||
|
@ -208,14 +218,7 @@ var LayerData = new Class({
|
|||
*/
|
||||
this.tilemapLayer = GetFastValue(config, 'tilemapLayer', null);
|
||||
|
||||
/**
|
||||
* The layer's orientation, necessary to be able to determine pixelX and pixelY.
|
||||
*
|
||||
* @name Phaser.Tilemaps.LayerData#orientation
|
||||
* @type {string}
|
||||
* @since 3.2.PR_svipal
|
||||
*/
|
||||
this.orientation = GetFastValue(config, 'orientation', "orthogonal");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -1071,7 +1071,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera)
|
||||
{
|
||||
return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.GetTilesWithinWorldXY(worldX, worldY, width, height, filteringOptions, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1089,7 +1089,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
getTilesWithinShape: function (shape, filteringOptions, camera)
|
||||
{
|
||||
return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.GetTilesWithinShape(shape, filteringOptions, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1125,7 +1125,7 @@ var StaticTilemapLayer = new Class({
|
|||
hasTileAtWorldXY: function (worldX, worldY, camera)
|
||||
{
|
||||
|
||||
return TilemapComponents.HasTileAtWorldXY(worldX, worldY, camera, this.tilemap.orientation);
|
||||
return TilemapComponents.HasTileAtWorldXY(worldX, worldY, camera);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1392,7 +1392,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileX: function (worldX, snapToFloor, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileX(worldX, snapToFloor, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1411,7 +1411,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileY: function (worldY, snapToFloor, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileY(worldY, snapToFloor, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1433,7 +1433,7 @@ var StaticTilemapLayer = new Class({
|
|||
*/
|
||||
worldToTileXY: function (worldX, worldY, snapToFloor, point, camera)
|
||||
{
|
||||
return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer, this.tilemap.orientation);
|
||||
return TilemapComponents.WorldToTileXY(worldX, worldY, snapToFloor, point, camera, this.layer);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue