mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 09:48:18 +00:00
Merge pull request #5657 from moJiXiang/fix-bug-#5647
fix PutTileAt tile size with releated tileset width and height, releated bug #5647
This commit is contained in:
commit
7434769faf
1 changed files with 11 additions and 0 deletions
|
@ -8,6 +8,7 @@ var Tile = require('../Tile');
|
|||
var IsInLayerBounds = require('./IsInLayerBounds');
|
||||
var CalculateFacesAt = require('./CalculateFacesAt');
|
||||
var SetTileCollision = require('./SetTileCollision');
|
||||
var BuildTilesetIndex = require('../parsers/tiled/BuildTilesetIndex');
|
||||
|
||||
/**
|
||||
* Puts a tile at the given tile coordinates in the specified layer. You can pass in either an index
|
||||
|
@ -65,6 +66,16 @@ var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer)
|
|||
var newTile = layer.data[tileY][tileX];
|
||||
var collides = layer.collideIndexes.indexOf(newTile.index) !== -1;
|
||||
|
||||
// Copy properties from tileset to tiles.
|
||||
var tiles = BuildTilesetIndex(layer.tilemapLayer.tilemap);
|
||||
var index = tile instanceof Tile ? tile.index : tile;
|
||||
|
||||
var sid = tiles[index][2];
|
||||
var set = layer.tilemapLayer.tileset[sid];
|
||||
|
||||
newTile.width = set.tileWidth;
|
||||
newTile.height = set.tileHeight;
|
||||
|
||||
SetTileCollision(newTile, collides);
|
||||
|
||||
// Recalculate faces only if the colliding flag at (tileX, tileY) has changed
|
||||
|
|
Loading…
Reference in a new issue