Closed
Description
Version
- Phaser Version: 3.88.2
Description
Tilemap.createFromTiles with useSpriteSheet specified in the SpriteConfig assigns the frame number just using the current tile index without taking into account that the tile index doesn't always start from 1 for all tilesets other than the very first one.
Example Test Code
The sprites created from the second tileset are all wrong

To test the fix locally comment lines 221-230 and uncomment lines 233-242 in Game.ts in the StackBlitz .
Sprites are properly created after the fix
Additional Information
The line at
| config.frame = tile.index - 1; |
config.frame = tile.index - 1;
needs to be changed to
config.frame = tile.index - tile.tileset.firstgid;
Tested the fix locally by creating a secondary copy of createFromTiles in my project and applying the above fix.
Metadata
Metadata
Assignees
Labels
No labels

Activity
Fix createFromTiles to handle multiple tilesets when using sprite sheets