Creates a Sprite for every object matching the given tile indexes in the layer. You can optionally specify if each tile will be replaced with a new tile after the Sprite has been 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.
name | type | arguments | description |
---|---|---|---|
indexes | number | array |
The tile index, or array of indexes, to create Sprites from. |
|
replacements | number | array |
The tile index, or array of indexes, to change a converted
tile to. Set to |
|
spriteConfig | Phaser.Types.GameObjects.Sprite.SpriteConfig |
The config object to pass into the Sprite creator (i.e. scene.make.sprite). |
|
scene | Phaser.Scene | <optional> |
The Scene to create the Sprites within. |
camera | Phaser.Cameras.Scene2D.Camera | <optional> |
The Camera to use when calculating the tile index from the world values. |
layer | string | number | Phaser.Tilemaps.TilemapLayer | <optional> |
The tile layer to use. If not given the current layer is used. |
Returns an array of Tiles, or null if the layer given was invalid.