mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 14:38:30 +00:00
Small fix: use base tile size for tile <-> XY transforms. This only matters for maps with different size tiles.
This commit is contained in:
parent
37767ebde1
commit
a8fdcbc56b
6 changed files with 12 additions and 7 deletions
|
@ -1061,9 +1061,12 @@ var Tilemap = new Class({
|
|||
this.widthInPixels = this.width * tileWidth;
|
||||
this.heightInPixels = this.height * tileHeight;
|
||||
|
||||
// Update the base tile size on all tiles
|
||||
// Update the base tile size on all layers & tiles
|
||||
for (var i = 0; i < this.layers.length; i++)
|
||||
{
|
||||
this.layers[i].baseWidth = tileWidth;
|
||||
this.layers[i].baseHeight = tileHeight;
|
||||
|
||||
var mapData = this.layers[i].data;
|
||||
var mapWidth = this.layers[i].width;
|
||||
var mapHeight = this.layers[i].height;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*/
|
||||
var TileToWorldX = function (tileX, camera, layer)
|
||||
{
|
||||
var tileWidth = layer.tileWidth;
|
||||
var tileWidth = layer.baseTileWidth;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
var layerWorldX = 0;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*/
|
||||
var TileToWorldY = function (tileY, camera, layer)
|
||||
{
|
||||
var tileHeight = layer.tileHeight;
|
||||
var tileHeight = layer.baseTileHeight;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
var layerWorldY = 0;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ var WorldToTileX = function (worldX, snapToFloor, camera, layer)
|
|||
{
|
||||
if (snapToFloor === undefined) { snapToFloor = true; }
|
||||
|
||||
var tileWidth = layer.tileWidth;
|
||||
var tileWidth = layer.baseTileWidth;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
|
||||
if (tilemapLayer)
|
||||
|
|
|
@ -13,7 +13,7 @@ var WorldToTileY = function (worldY, snapToFloor, camera, layer)
|
|||
{
|
||||
if (snapToFloor === undefined) { snapToFloor = true; }
|
||||
|
||||
var tileHeight = layer.tileHeight;
|
||||
var tileHeight = layer.baseTileHeight;
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
|
||||
if (tilemapLayer)
|
||||
|
|
|
@ -26,8 +26,10 @@ var LayerData = new Class({
|
|||
this.height = GetFastValue(config, 'height', 0);
|
||||
this.tileWidth = GetFastValue(config, 'tileWidth', 0);
|
||||
this.tileHeight = GetFastValue(config, 'tileHeight', 0);
|
||||
this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.tileWidth);
|
||||
this.heightInPixels = GetFastValue(config, 'heightInPixels', this.height * this.tileHeight);
|
||||
this.baseTileWidth = GetFastValue(config, 'baseTileWidth', this.tileWidth);
|
||||
this.baseTileHeight = GetFastValue(config, 'baseTileHeight', this.tileHeight);
|
||||
this.widthInPixels = GetFastValue(config, 'widthInPixels', this.width * this.baseTileWidth);
|
||||
this.heightInPixels = GetFastValue(config, 'heightInPixels', this.height * this.baseTileHeight);
|
||||
this.alpha = GetFastValue(config, 'alpha', 1);
|
||||
this.visible = GetFastValue(config, 'visible', true);
|
||||
this.properties = GetFastValue(config, 'properties', {});
|
||||
|
|
Loading…
Add table
Reference in a new issue