createFromTiles(tiles, replacements, key, layer, group, properties) → {integer}
Creates a Sprite for every object matching the given tile indexes in the map data.
You can specify the group that the Sprite will be created in. If none is given it will be created in the World.
You can optional specify if the tile will be replaced with another after the Sprite is created. This is useful if you want to lay down special
tiles in a level that are converted to Sprites, but want to replace the tile itself with a floor tile or similar once converted.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
tiles | integer | Array | The tile index, or array of indexes, to create Sprites from. | ||
replacements | integer | Array | The tile index, or array of indexes, to change a converted tile to. Set to | ||
key | string | The Game.cache key of the image that this Sprite will use. | ||
layer | number | string | Phaser.TilemapLayer | <optional> | The layer to operate on. | |
group | Phaser.Group | <optional> | Phaser.World | Group to add the Sprite to. If not specified it will be added to the World group. |
properties | object | <optional> | An object that contains the default properties for your newly created Sprite. This object will be iterated and any matching Sprite property will be set. |
Returns
The number of Sprites that were created.
- Source code: tilemap/Tilemap.js (Line 467)
Please login to continue.