mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 14:08:28 +00:00
The Tilemap.createFromTiles
method has been updated. It will now copy the following properties, if set in the Tile, to the Sprites it creates: rotation
, flipX
, flipY
, alpha
, visible
and tint
. If these properties are declared in the spriteConfig
passed to the method, those will be used instead, otherwise the Tile values are used. Fix #6711
This commit is contained in:
parent
ffc0518f2d
commit
89811d7388
1 changed files with 15 additions and 0 deletions
|
@ -43,6 +43,19 @@ var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, came
|
|||
var sprites = [];
|
||||
var i;
|
||||
|
||||
var mergeExtras = function (config, tile, properties)
|
||||
{
|
||||
for (var i = 0; i < properties.length; i++)
|
||||
{
|
||||
var property = properties[i];
|
||||
|
||||
if (!config.hasOwnProperty(property))
|
||||
{
|
||||
config[property] = tile[property];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
for (i = 0; i < tiles.length; i++)
|
||||
{
|
||||
var tile = tiles[i];
|
||||
|
@ -54,6 +67,8 @@ var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, came
|
|||
spriteConfig.x = point.x;
|
||||
spriteConfig.y = point.y;
|
||||
|
||||
mergeExtras(spriteConfig, tile, [ 'rotation', 'flipX', 'flipY', 'alpha', 'visible', 'tint' ]);
|
||||
|
||||
sprites.push(scene.make.sprite(spriteConfig));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue