Attention: Here be dragons
This is thelatest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
Using TileMaps
See also
This page assumes you have created or downloaded a TileSet already. If not,please readUsing TileSets first as you will need a TileSetto create a TileMap.
Introduction
A tilemap is a grid of tiles used to create a game's layout. There are severalbenefits to usingTileMapLayer nodes to design your levels.First, they make it possible to draw the layout by "painting" the tiles onto agrid, which is much faster than placing individualSprite2Dnodes one by one. Second, they allow for much larger levels because they areoptimized for drawing large numbers of tiles. Finally, you can add collision,occlusion, and navigation shapes to tiles, adding greater functionality tothe TileMap.
Specifying the TileSet in the TileMapLayer
If you've followed the previous page onUsing TileSets, you shouldhave a TileSet resource that is built into the TileMapLayer node. This is good forprototyping, but in a real world project, you will generally have multiplelevels reusing the same tileset.
The recommended way to reuse the same TileSet in several TileMapLayer nodes is to savethe TileSet to an external resource. To do so, click the dropdown next to the TileSetresource and chooseSave:

Saving the built-in TileSet resource to an external resource file
Multiple TileMapLayers and settings
When working with tilemaps it's generally advised that you use multiple TileMapLayernodes when appropriate. Using multiple layers can be advantageous, for example,this allows you to distinguish foreground tiles from background tiles for betterorganization. You can place one tile per layer at a given location, which allows youto overlap several tiles together if you have more than one layer.
Each TileMapLayer node has several properties you can adjust:
Enabled: If
true, the layer is visible in the editor and when runningthe project.TileSet The tileset used by the TileMapLayer node.
Rendering
Y Sort Origin: The vertical offset to use for Y-sorting on each tile (in pixels).Only effective ifY Sort Enabled under CanvasItem settings is
true.X Draw Order Reversed Reverses the order tiles are drawn on the X axis. RequiresthatY Sort Enabled under CanvasItem settings is
true.Rendering Quadrant Size A quadrant is a group of tiles drawn together on a singleCanvasItem for optimization purposes. This setting defines the length of a square'sside in the map's coordinate system. The quadrant size does not apply to a Y sortedTileMapLayer since tiles are grouped by Y position in that case.
Physics
Collision Enabled Enables or disables collision.
Use Kinematic Bodies When true TileMapLayer collision shapes will be instantiatedas kinematic bodies.
Collision Visibility Mode Whether or not the TileMapLayer's collision shapes arevisible. If set to default, then it depends on the show collision debug settings.
Navigation
Navigation Enabled Whether or not navigation regions are enabled.
Navigation Visible Whether or not the TileMapLayer's navigation meshes arevisible. If set to default then it depends on the show navigation debug settings.
Tip
TileMap built-in navigation has many practical limitations that result in inferior pathfinding performance and pathfollowing quality.
After designing the TileMap consider baking it to a more optimized navigation mesh (and disabling the TileMap NavigationLayer) using aNavigationRegion2D or theNavigationServer2D. SeeUsing navigation meshes for additional information.
Warning
2D navigation meshes can not be "layered" or stacked on top of each other like visuals or physic shapes. Attempting to stack navigation meshes on the same navigation map will result in merge and logical errors that break the pathfinding.
Reordering layers
You can reorder layers by drag-and-dropping their node in the Scene tab. You canalso switch between which TileMapLayer node you're working on by using the buttonsin the top right corner of the TileMap editor.
Note
You can create, rename or reorder layers in the future without affectingexisting tiles. Be careful though, asremoving a layer will also removeall tiles that were placed on the layer.
Opening the TileMap editor
Select the TileMapLayer node, then open the TileMap panel at the bottomof the editor:

Opening the TileMap panel at the bottom of the editor. The TileMapLayer node must be selected first.
Selecting tiles to use for painting
First, if you've created additional layers above, make sure you've selected thelayer you wish to paint on:

Selecting a layer to paint on in the TileMap editor
Tip
In the 2D editor, the layers you aren't currently editing from the sameTileMapLayer node will appear grayed out while in the TileMap editor. You candisable this behavior by clicking the icon next to the layer selection menu(Highlight Selected TileMap Layer tooltip).
You can skip the above step if you haven't created additional layers, as thefirst layer is automatically selected when entering the TileMap editor.
Before you can place tiles in the 2D editor, you must select one or more tilesin the TileMap panel located at the bottom of the editor. To do so, click a tilein the TileMap panel, or hold down the mouse button to select multiple tiles:

Selecting a tile in the TileMap editor by clicking it
Tip
Like in the 2D and TileSet editors, you can pan across the TileMap panel usingthe middle or right mouse buttons, and zoom using the mouse wheel or buttons inthe top-left corner.
You can also hold downShift to append to the current selection. Whenselecting more than one tile, multiple tiles will be placed every time youperform a painting operation. This can be used to paint structures composed ofmultiple tiles in a single click (such as large platforms or trees).
The final selection does not have to be contiguous: if there is empty spacebetween selected tiles, it will be left empty in the pattern that will bepainted in the 2D editor.

Selecting multiple tiles in the TileMap editor by holding down the left mouse button
If you've created alternative tiles in your TileSet, you can select them forpainting on the right of the base tiles:

Selecting an alternative tile in the TileMap editor
Lastly, if you've created ascenes collection in the TileSet, you can place scene tiles in the TileMap:

Placing a scene tile containing particles using the TileMap editor
Painting modes and tools
Using the toolbar at the top of the TileMap editor, you can choose betweenseveral painting modes and tools. These modes affect operation when clicking inthe 2D editor,not the TileMap panel itself.
From left to right, the painting modes and tools you can choose are:
Selection
Select tiles by clicking a single tile, or by holding down the left mouse button toselect multiple with a rectangle in the 2D editor. Note that empty space cannot beselected: if you create a rectangle selection, only non-empty tiles will be selected.
To append to the current selection, holdShift then select a tile.To remove from the current selection, holdCtrl then select a tile.
The selection can then be used in any other painting mode to quickly create copiesof an already-placed pattern.
You can remove the selected tiles from the TileMap by pressingDel.
You can toggle this mode temporarily while in Paint mode by holdingCtrlthen performing a selection.
Tip
You can copy and paste tiles that were already placed by performing aselection, pressingCtrl+C then pressingCtrl+V.The selection will be pasted after left-clicking. You can pressCtrl+V another time to perform more copies this way.Right-click or pressEscape to cancel pasting.
Paint
The standard Paint mode allows you to place tiles by clicking or holdingdown the left mouse button.
If you right-click, the currently selected tile will be erased from the tilemap.In other words, it will be replaced by empty space.
If you have selected multiple tiles in the TileMap or using the Selection tool,they will be placed every time you click or drag the mouse while holding downthe left mouse button.
Tip
While in Paint mode, you can draw a line by holdingShiftbeforeholding down the left mouse button, then dragging the mouse to the line's endpoint. This is identical to using the Line tool described below.
You can also draw a rectangle by holdingCtrl andShiftbefore holding down the left mouse button, then dragging the mouse to therectangle's end point. This is identical to using the Rectangle tooldescribed below.
Lastly, you can pick existing tiles in the 2D editor by holdingCtrlthen clicking on a tile (or holding and dragging the mouse).This will switch the currently painted tile(s) to the tile(s) you've just clicked.This is identical to using the Picker tool described below.
Line
After selecting Line Paint mode, you can draw in a line that isalways 1 tile thick (no matter its orientation).
If you right-click while in Line Paint mode, you will erase in a line.
If you have selected multiple tiles in the TileMap or using the Selection tool,you can place them in a repeating pattern across the line.
You can toggle this mode temporarily while in Paint or Eraser mode by holdingShift then drawing.

Using the line tool after selecting two tiles to draw platforms diagonally
Rectangle
After selecting Rectangle Paint mode, you can draw in an axis-alignedrectangle.
If you right-click while in Rectangle Paint mode, you will erase inan axis-aligned rectangle.
If you have selected multiple tiles in the TileMap or using the Selection tool,you can place them in a repeating pattern within the rectangle.
You can toggle this mode temporarily while in Paint or Eraser mode by holdingCtrl andShift then drawing.
Bucket Fill
After selecting Bucket Fill mode, you can choose whether painting should belimited to contiguous areas only by toggling theContiguous checkbox thatappears on the right of the toolbar.
If you enableContiguous (the default), only matching tiles that touch thecurrent selection will be replaced. This contiguous check is performedhorizontally and vertically, butnot diagonally.
If you disableContiguous, all tiles with the same ID in the entire TileMap willbe replaced by the currently selected tile. If selecting an empty tile withContiguous unchecked, all tiles in the rectangle that encompasses theTileMap's effective area will be replaced instead.
If you right-click while in Bucket Fill mode, you will replace matching tileswith empty tiles.
If you have selected multiple tiles in the TileMap or using the Selection tool,you can place them in a repeating pattern within the filled area.

Using the Bucket Fill tool
Picker
After selecting Picker mode, you can pick existing tiles in the 2D editor byholdingCtrl then clicking on a tile. This will switch the currentlypainted tile to the tile you've just clicked. You can also pick multiple tilesat once by holding down the left mouse button and forming a rectangle selection.Only non-empty tiles can be picked.
You can toggle this mode temporarily while in Paint mode by holdingCtrlthen clicking or dragging the mouse.
Eraser
This mode is combined with any other painting mode (Paint, Line, Rectangle,Bucket Fill). When eraser mode is enabled, tiles will be replaced by empty tilesinstead of drawing new lines when left-clicking.
You can toggle this mode temporarily while in any other mode by right-clickinginstead of left-clicking.
Painting randomly using scattering
While painting, you can optionally enablerandomization. When enabled,a random tile will be chosen between all the currently selected tiles whenpainting. This is supported with the Paint, Line, Rectangle and Bucket Filltools. For effective paint randomization, you must select multiple tilesin the TileMap editor or use scattering (both approaches can be combined).
IfScattering is set to a value greater than 0, there is a chance that no tilewill be placed when painting. This can be used to add occasional, non-repeatingdetail to large areas (such as adding grass or crumbs on a large top-downTileMap).
Example when using Paint mode:

Selecting from several times to randomly choose, then painting by holding down the left mouse button
Example when using Bucket Fill mode:

Using Bucket Fill tool with a single tile, but with randomization and scattering enabled
Note
Eraser mode does not take randomization and scattering into account.All tiles within the selection are always removed.
Saving and loading premade tile placements using patterns
While you can copy and paste tiles while in Select mode, you may wish to savepremadepatterns of tiles to place together in a go. This can be done on aper-TileMap basis by choosing thePatterns tab of the TileMap editor.
To create a new pattern, switch to Select mode, perform a selection and pressCtrl+C. Click on empty space within the Patterns tab (a blue focusrectangle should appear around the empty space), then pressCtrl+V:

Creating a new pattern from a selection in the TileMap editor
To use an existing pattern, click its image in thePatterns tab, switch toany painting mode, then left-click somewhere in the 2D editor:

Placing an existing pattern using the TileMap editor
Like multi-tile selections, patterns will be repeated if used with the Line,Rectangle or Bucket Fill painting modes.
Note
Despite being edited in the TileMap editor, patterns are stored in theTileSet resource. This allows reusing patterns in different TileMapLayer nodesafter loading a TileSet resource saved to an external file.
Handling tile connections automatically using terrains
To use terrains, the TileMapLayer node must feature at least one terrain set and aterrain within this terrain set. SeeCreating terrain sets (autotiling) if you haven't created a terrainset for the TileSet yet.
There are 3 kinds of painting modes available for terrain connections:
Connect, where tiles are connected to surrounding tiles on the sameTileMapLayer.
Path, where tiles are connected to tiles painted in the same stroke (untilthe mouse button is released).
Tile-specific overrides to resolve conflicts or handle situations not coveredby the terrain system.
The Connect mode is easier to use, but Path is more flexible as it allows formore artist control during painting. For instance, Path can allow roads to bedirectly adjacent to each other without being connected to each other, whileConnect will force both roads to be connected.

Selecting Connect mode in the TileMap editor's Terrains tab

Selecting Path mode in the TileMap editor's Terrains tab
Lastly, you can select specific tiles from the terrain to resolve conflicts incertain situations:

Painting with specific tiles in the TileMap editor's Terrains tab
Any tile that has at least one of its bits set to a value set to thecorresponding terrain ID will appear in the list of tiles to choose from.
Handling missing tiles
If you remove tiles in the TileSet that are referenced in a TileMap, the TileMapwill display a placeholder to indicate that an invalid tile ID is placed:

Missing tiles in the TileMap editor due to the TileSet reference being broken
These placeholders arenot visible in the running project, but the tile datais still persisted to disk. This allows you to safely close and reopen suchscenes. Once you re-add a tile with the matching ID, the tiles will appear withthe new tile's appearance.
Note
Missing tile placeholders may not be visible until you select the TileMapLayernode and open the TileMap editor.