TileMapLayer Example Project
Download the example ZIP to try two TileMapLayer nodes sharing a TileSet. It includes original tile art, GDScript, scene and resource files, and a README. The TileMapLayer tutorial explains new-project setup and migration separately.
The example uses the TileMapLayer API introduced in Godot 4.3. It was imported, run and behavior-tested with Godot 4.7.2 on Linux. Earlier versions and other operating systems were not run in this verification.
Open and run
- Extract the ZIP to a new folder.
- Import
project.godotin Godot’s Project Manager and wait for the SVG tile art to import. - Open
main.tscnand press F6. - Press Space to paint or erase the gold tile at map cell
(3, 5).
The screenshot on the tutorial is the running example, not an illustration of an editor menu. There is no player, collision setup, or terrain-autotiling configuration.
Adapt the map
Ground and Details share tileset.tres. Select either layer to edit its tiles. The atlas source ID is 7, not 0:
| Atlas coordinates | Tile |
|---|---|
(0, 0) | Grass |
(1, 0) | Stone |
(2, 0) | Water |
(3, 0) | Gold |
demo.gd seeds the map at runtime. Change that script to change the initial map. Editor-painted cells are separate from the script’s seeding, which can overwrite cells when you run the scene. set_cell() takes a map cell position, source ID and atlas coordinates; it does not take a layer index.
The README includes a headless check that verifies the shared TileSet, source ID, painting, erasing, and the same toggle function used by Space:
godot --headless --path . -- --verifyPlan and privacy
The download is available without an account on every plan. It does not require Ziva, an AI model, a paid asset, or an export service. The project contains no analytics, network calls, account integration or external plugins. Inspect its files before adding code to your own project.
Troubleshooting
- Missing tiles: wait for
tiles.svgto import, then check source ID 7 and the atlas coordinates above. - Editor changes differ from the running map: runtime seeding in
demo.gdcan replace cells. Remove or adapt that seeding when you want to author the complete map in the editor. - Space does nothing: focus the game window. The toggle changes the gold tile on
Details, not the grass tile onGroundunderneath it. - Godot 3 or 4.2: TileMapLayer is unavailable. Use Godot 4.3 or later; the verified version for this download is 4.7.2.
- Need movement, collisions or terrains: this example deliberately covers layer and cell setup only. Add and test those systems separately rather than assuming they are configured.