Tiled flipped tiles look wrong? Clear the GID flags first
Use two GIDs and one firstgid to isolate a Tiled import error in tile lookup or orientation.


If ordinary floor tiles render and mirrored ones disappear, check the raw global tile IDs before rebuilding the atlas. This fixture is for a custom reader of orthogonal tile layers exported from Tiled as TMX or JSON.
Trace one tile through the importer
- Create a tiny map with one tileset. Check that its exported
firstgidis 1. Paint the first tile, a right-facing floor arrow, into two cells. Flip the second copy horizontally. - Read each exported value as an unsigned 32-bit integer. The expected pair is
0x00000001and0x80000001. Capture the high four bits before usinggid & 0x0FFFFFFFto obtain the underlying GID. - Treat clean ID zero as empty. Otherwise, select the tileset with the greatest
firstgidthat does not exceed the clean ID, then subtract it. Both cells should resolve to local index zero. Only the second copy gets a horizontal flip at render time.
Check the lookup and transform separately
If both cells resolve to the same artwork but face the wrong way, inspect the transform sequence. On an orthogonal map, apply diagonal flipping before horizontal and vertical flipping. Clear all four high bits during lookup, including the hex rotation bit, which can survive an orientation change. Use Sprite Sheet Packer to prepare the artwork and keep GID and orientation checks in your importer.
Recommended tools

Sprite Sheet Splitter Guide: Extract Animation Frames for 2D Games
Learn how a sprite sheet splitter extracts clean animation frames from character sheets, VFX sheets, tiles, UI sprites, and AI-generated game assets.

Best Sprite Sheet Packer Settings for Indie Game Assets
A practical SEO-friendly guide to sprite sheet packer settings, including atlas size, padding, trimming, extrude, rotation, metadata, and recommended export settings for 2D game assets.

Smart Sprite Sheet Packer: A Practical Guide for 2D Game Developers
Learn how a smart sprite sheet packer helps indie game developers combine PNG assets into clean texture atlases with metadata for Unity, Cocos, Godot, and custom 2D game engines.
Ready to try "Tiled flipped tiles look wrong? Clear the GID flags first"?
Use our online tools to apply this tutorial to your indie game project right away.
