mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
Tile.properties is now unique to that specific Tile, and not a reference to the Tileset index bound properties object. Tile.properties can now be modified freely without impacting other tiles sharing the same id (#1254)
This commit is contained in:
parent
8892f46a83
commit
daf8440247
2 changed files with 17 additions and 9 deletions
|
@ -128,6 +128,7 @@ Thanks to @pnstickne for vast majority of this update.
|
|||
* Text font components can now be specified as part of "style". There is a breaking change in that the `fontWeight` now only handles the CSS font-weight component. The `fontStyle` property handles 'italic', 'oblique', values from font-style. This makes the overall consistency cleaner but some code may need to be updated. This does not affect font-weight/font-style as with setStyle({font:..}). Also fixes overwrite font/size/weight oddities - which may result in different behavior for code that was relying on such. All of the text examples appear to work and modification using the new features (while respecting the change in previous behavior) work better (thanks @pnstickne #1375 #1370)
|
||||
* Loader.audiosprite has a new `jsonData` parameter. It allows you to pass a pre-existing JSON object (or a string which will be parsed as JSON) to use as the audiosprite data, instead of specifying a URL to a JSON file on the server (thanks @jounii #1447)
|
||||
* Loader.audiosprite has a new `autoDecode` parameter. If `true` the audio file will be decoded immediately upon load.
|
||||
* Tile.properties is now unique to that specific Tile, and not a reference to the Tileset index bound properties object. Tile.properties can now be modified freely without impacting other tiles sharing the same id (#1254)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
|
|
@ -581,39 +581,46 @@ Phaser.TilemapParser = {
|
|||
|
||||
// assign tile properties
|
||||
|
||||
var i,j,k;
|
||||
var layer, tile, sid, set;
|
||||
var layer;
|
||||
var tile;
|
||||
var sid;
|
||||
var set;
|
||||
|
||||
// go through each of the map layers
|
||||
for (i = 0; i < map.layers.length; i++)
|
||||
for (var i = 0; i < map.layers.length; i++)
|
||||
{
|
||||
layer = map.layers[i];
|
||||
|
||||
// rows of tiles
|
||||
for (j = 0; j < layer.data.length; j++)
|
||||
for (var j = 0; j < layer.data.length; j++)
|
||||
{
|
||||
row = layer.data[j];
|
||||
|
||||
// individual tiles
|
||||
for (k = 0; k < row.length; k++)
|
||||
for (var k = 0; k < row.length; k++)
|
||||
{
|
||||
tile = row[k];
|
||||
|
||||
if(tile.index < 0) { continue; }
|
||||
if (tile.index < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// find the relevant tileset
|
||||
|
||||
sid = map.tiles[tile.index][2];
|
||||
set = map.tilesets[sid];
|
||||
|
||||
// if that tile type has any properties, add them to the tile object
|
||||
if(set.tileProperties && set.tileProperties[tile.index - set.firstgid]) {
|
||||
tile.properties = set.tileProperties[tile.index - set.firstgid];
|
||||
|
||||
if (set.tileProperties && set.tileProperties[tile.index - set.firstgid])
|
||||
{
|
||||
tile.properties = Phaser.Utils.mixin(set.tileProperties[tile.index - set.firstgid], tile.properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return map;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue