mirror of
https://github.com/Relintai/pandemonium_engine_docs.git
synced 2025-01-06 15:00:03 +01:00
Class name updates.
This commit is contained in:
parent
36a3c5ff80
commit
4ffba3b0f0
@ -1,80 +1,80 @@
|
|||||||
.. _doc_using_tilemaps:
|
.. _doc_using_tilemaps:
|
||||||
|
|
||||||
Using TileMaps
|
Using LayeredTileMaps
|
||||||
==============
|
==============
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
This page assumes you have created or downloaded a TileSet already. If not,
|
This page assumes you have created or downloaded a LayeredTileSet already. If not,
|
||||||
please read :ref:`doc_using_tilesets` first as you will need a TileSet
|
please read :ref:`doc_using_tilesets` first as you will need a LayeredTileSet
|
||||||
to create a TileMap.
|
to create a LayeredTileMap.
|
||||||
|
|
||||||
Introduction
|
Introduction
|
||||||
------------
|
------------
|
||||||
|
|
||||||
A tilemap is a grid of tiles used to create a game's layout. There are several
|
A tilemap is a grid of tiles used to create a game's layout. There are several
|
||||||
benefits to using :ref:`TileMap <class_TileMap>` nodes to design your levels.
|
benefits to using :ref:`LayeredTileMap <class_LayeredTileMap>` nodes to design your levels.
|
||||||
First, they make it possible to draw the layout by "painting" the tiles onto a
|
First, they make it possible to draw the layout by "painting" the tiles onto a
|
||||||
grid, which is much faster than placing individual :ref:`Sprite2D <class_Sprite2D>`
|
grid, which is much faster than placing individual :ref:`Sprite2D <class_Sprite2D>`
|
||||||
nodes one by one. Second, they allow for much larger levels because they are
|
nodes one by one. Second, they allow for much larger levels because they are
|
||||||
optimized for drawing large numbers of tiles. Finally, you can add collision,
|
optimized for drawing large numbers of tiles. Finally, you can add collision,
|
||||||
occlusion, and navigation shapes to tiles, adding greater functionality to
|
occlusion, and navigation shapes to tiles, adding greater functionality to
|
||||||
the TileMap.
|
the LayeredTileMap.
|
||||||
|
|
||||||
Specifying the TileSet in the TileMap
|
Specifying the LayeredTileSet in the LayeredTileMap
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
If you've followed the previous page on :ref:`doc_using_tilesets`, you should
|
If you've followed the previous page on :ref:`doc_using_tilesets`, you should
|
||||||
have a TileSet resource that is built-in to the TileMap node. This is good for
|
have a LayeredTileSet resource that is built-in to the LayeredTileMap node. This is good for
|
||||||
prototyping, but in a real world project, you will generally have multiple
|
prototyping, but in a real world project, you will generally have multiple
|
||||||
levels reusing the same tileset.
|
levels reusing the same tileset.
|
||||||
|
|
||||||
The recommended way to reuse the same TileSet in several TileMap nodes is to save
|
The recommended way to reuse the same LayeredTileSet in several LayeredTileMap nodes is to save
|
||||||
the TileSet to an external resource. To do so, click the dropdown next to the TileSet
|
the LayeredTileSet to an external resource. To do so, click the dropdown next to the LayeredTileSet
|
||||||
resource and choose **Save**:
|
resource and choose **Save**:
|
||||||
|
|
||||||
.. figure:: img/using_tilemaps_save_tileset_to_resource.webp
|
.. figure:: img/using_tilemaps_save_tileset_to_resource.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Saving the built-in TileSet resource to an external resource file
|
:alt: Saving the built-in LayeredTileSet resource to an external resource file
|
||||||
|
|
||||||
Saving the built-in TileSet resource to an external resource file
|
Saving the built-in LayeredTileSet resource to an external resource file
|
||||||
|
|
||||||
Creating TileMap layers
|
Creating LayeredTileMap layers
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
As of Godot 4.0, you can place several *layers* in a single TileMap node. For
|
As of Godot 4.0, you can place several *layers* in a single LayeredTileMap node. For
|
||||||
example, this allows you to distinguish foreground tiles from background tiles
|
example, this allows you to distinguish foreground tiles from background tiles
|
||||||
for better organization. You can place one tile per layer at a given location,
|
for better organization. You can place one tile per layer at a given location,
|
||||||
which allows you to overlap several tiles together if you have more than one layer.
|
which allows you to overlap several tiles together if you have more than one layer.
|
||||||
|
|
||||||
By default, a TileMap node automatically has one premade layer. You do not have
|
By default, a LayeredTileMap node automatically has one premade layer. You do not have
|
||||||
to create additional layers if you only need a single layer, but if you wish to
|
to create additional layers if you only need a single layer, but if you wish to
|
||||||
do so now, select the TileMap node and unfold the **Layers** section in the
|
do so now, select the LayeredTileMap node and unfold the **Layers** section in the
|
||||||
inspector:
|
inspector:
|
||||||
|
|
||||||
.. figure:: img/using_tilemaps_create_layers.webp
|
.. figure:: img/using_tilemaps_create_layers.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Creating layers in a TileMap node (example with "background" and "foreground")
|
:alt: Creating layers in a LayeredTileMap node (example with "background" and "foreground")
|
||||||
|
|
||||||
Creating layers in a TileMap node (example with "background" and "foreground")
|
Creating layers in a LayeredTileMap node (example with "background" and "foreground")
|
||||||
|
|
||||||
Each layer has several properties you can adjust:
|
Each layer has several properties you can adjust:
|
||||||
|
|
||||||
- **Name:** A human-readable name to display in the TileMap editor. This can be
|
- **Name:** A human-readable name to display in the LayeredTileMap editor. This can be
|
||||||
something like "background", "buildings", "vegetation", etc.
|
something like "background", "buildings", "vegetation", etc.
|
||||||
- **Enabled:** If ``true``, the layer is visible in the editor and when running
|
- **Enabled:** If ``true``, the layer is visible in the editor and when running
|
||||||
the project.
|
the project.
|
||||||
- **Modulate:** The color to use as a multiplier for all tiles on the layer.
|
- **Modulate:** The color to use as a multiplier for all tiles on the layer.
|
||||||
This is also multiplied with the per-tile **Modulate** property and the
|
This is also multiplied with the per-tile **Modulate** property and the
|
||||||
TileMap node's **Modulate** property. For example, you can use this to darken
|
LayeredTileMap node's **Modulate** property. For example, you can use this to darken
|
||||||
background tiles to make foreground tiles stand out more.
|
background tiles to make foreground tiles stand out more.
|
||||||
- **Y Sort Enabled:** If ``true``, sorts tiles based on their Y position on the
|
- **Y Sort Enabled:** If ``true``, sorts tiles based on their Y position on the
|
||||||
TileMap. This can be used to prevent sorting issues with certain tile setups,
|
LayeredTileMap. This can be used to prevent sorting issues with certain tile setups,
|
||||||
especially with isometric tiles.
|
especially with isometric tiles.
|
||||||
- **Y Sort Origin:** The vertical offset to use for Y-sorting on each tile (in pixels).
|
- **Y Sort Origin:** The vertical offset to use for Y-sorting on each tile (in pixels).
|
||||||
Only effective if **Y Sort Enabled** is ``true``.
|
Only effective if **Y Sort Enabled** is ``true``.
|
||||||
- **Z Index:** Controls whether this layer is drawn in front of or behind other
|
- **Z Index:** Controls whether this layer is drawn in front of or behind other
|
||||||
TileMap layers. This value can be positive or negative; the layer with the highest Z
|
LayeredTileMap layers. This value can be positive or negative; the layer with the highest Z
|
||||||
Index is drawn on top of other layers. If several layers have an equal Z Index
|
Index is drawn on top of other layers. If several layers have an equal Z Index
|
||||||
property, the layer that is *last* in the list of layers (the one which
|
property, the layer that is *last* in the list of layers (the one which
|
||||||
appears at the bottom in the list) is drawn on top.
|
appears at the bottom in the list) is drawn on top.
|
||||||
@ -88,17 +88,17 @@ the left of the entries in the **Layers** section.
|
|||||||
existing tiles. Be careful though, as *removing* a layer will also remove
|
existing tiles. Be careful though, as *removing* a layer will also remove
|
||||||
all tiles that were placed on the layer.
|
all tiles that were placed on the layer.
|
||||||
|
|
||||||
Opening the TileMap editor
|
Opening the LayeredTileMap editor
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
Select the TileMap node, then open the TileMap panel at the bottom
|
Select the LayeredTileMap node, then open the LayeredTileMap panel at the bottom
|
||||||
of the editor:
|
of the editor:
|
||||||
|
|
||||||
.. figure:: img/using_tilemaps_open_tilemap_editor.webp
|
.. figure:: img/using_tilemaps_open_tilemap_editor.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Opening the TileMap panel at the bottom of the editor. The TileMap node must be selected first.
|
:alt: Opening the LayeredTileMap panel at the bottom of the editor. The LayeredTileMap node must be selected first.
|
||||||
|
|
||||||
Opening the TileMap panel at the bottom of the editor. The TileMap node must be selected first.
|
Opening the LayeredTileMap panel at the bottom of the editor. The LayeredTileMap node must be selected first.
|
||||||
|
|
||||||
Selecting tiles to use for painting
|
Selecting tiles to use for painting
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
@ -108,33 +108,33 @@ layer you wish to paint on:
|
|||||||
|
|
||||||
.. figure:: img/using_tilemaps_select_layer.webp
|
.. figure:: img/using_tilemaps_select_layer.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Selecting a layer to paint on in the TileMap editor
|
:alt: Selecting a layer to paint on in the LayeredTileMap editor
|
||||||
|
|
||||||
Selecting a layer to paint on in the TileMap editor
|
Selecting a layer to paint on in the LayeredTileMap editor
|
||||||
|
|
||||||
.. tip::
|
.. tip::
|
||||||
|
|
||||||
In the 2D editor, the layers you aren't currently editing from the same
|
In the 2D editor, the layers you aren't currently editing from the same
|
||||||
TileMap node will appear grayed out while in the TileMap editor. You can
|
LayeredTileMap node will appear grayed out while in the LayeredTileMap editor. You can
|
||||||
disable this behavior by clicking the icon next to the layer selection menu
|
disable this behavior by clicking the icon next to the layer selection menu
|
||||||
(**Highlight Selected TileMap Layer** tooltip).
|
(**Highlight Selected LayeredTileMap Layer** tooltip).
|
||||||
|
|
||||||
You can skip the above step if you haven't created additional layers, as the
|
You can skip the above step if you haven't created additional layers, as the
|
||||||
first layer is automatically selected when entering the TileMap editor.
|
first layer is automatically selected when entering the LayeredTileMap editor.
|
||||||
|
|
||||||
Before you can place tiles in the 2D editor, you must select one or more tiles
|
Before you can place tiles in the 2D editor, you must select one or more tiles
|
||||||
in the TileMap panel located at the bottom of the editor. To do so, click a tile
|
in the LayeredTileMap panel located at the bottom of the editor. To do so, click a tile
|
||||||
in the TileMap panel, or hold down the mouse button to select multiple tiles:
|
in the LayeredTileMap panel, or hold down the mouse button to select multiple tiles:
|
||||||
|
|
||||||
.. figure:: img/using_tilemaps_select_single_tile_from_tileset.webp
|
.. figure:: img/using_tilemaps_select_single_tile_from_tileset.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Selecting a tile in the TileMap editor by clicking it
|
:alt: Selecting a tile in the LayeredTileMap editor by clicking it
|
||||||
|
|
||||||
Selecting a tile in the TileMap editor by clicking it
|
Selecting a tile in the LayeredTileMap editor by clicking it
|
||||||
|
|
||||||
.. tip::
|
.. tip::
|
||||||
|
|
||||||
Like in the 2D and TileSet editors, you can pan across the TileMap panel using
|
Like in the 2D and LayeredTileSet editors, you can pan across the LayeredTileMap panel using
|
||||||
the middle or right mouse buttons, and zoom using the mouse wheel or buttons in
|
the middle or right mouse buttons, and zoom using the mouse wheel or buttons in
|
||||||
the top-left corner.
|
the top-left corner.
|
||||||
|
|
||||||
@ -149,33 +149,33 @@ painted in the 2D editor.
|
|||||||
|
|
||||||
.. figure:: img/using_tilemaps_select_multiple_tiles_from_tileset.webp
|
.. figure:: img/using_tilemaps_select_multiple_tiles_from_tileset.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Selecting multiple tiles in the TileMap editor by holding down the left mouse button
|
:alt: Selecting multiple tiles in the LayeredTileMap editor by holding down the left mouse button
|
||||||
|
|
||||||
Selecting multiple tiles in the TileMap editor by holding down the left mouse button
|
Selecting multiple tiles in the LayeredTileMap editor by holding down the left mouse button
|
||||||
|
|
||||||
If you've created alternative tiles in your TileSet, you can select them for
|
If you've created alternative tiles in your LayeredTileSet, you can select them for
|
||||||
painting on the right of the base tiles:
|
painting on the right of the base tiles:
|
||||||
|
|
||||||
.. figure:: img/using_tilemaps_use_alternative_tile.webp
|
.. figure:: img/using_tilemaps_use_alternative_tile.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Selecting an alternative tile in the TileMap editor
|
:alt: Selecting an alternative tile in the LayeredTileMap editor
|
||||||
|
|
||||||
Selecting an alternative tile in the TileMap editor
|
Selecting an alternative tile in the LayeredTileMap editor
|
||||||
|
|
||||||
Lastly, if you've created a *scenes collection* in the TileSet, you can place scene tiles in the TileMap:
|
Lastly, if you've created a *scenes collection* in the LayeredTileSet, you can place scene tiles in the LayeredTileMap:
|
||||||
|
|
||||||
.. figure:: img/using_tilemaps_placing_scene_tiles.webp
|
.. figure:: img/using_tilemaps_placing_scene_tiles.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Placing a scene tile containing particles using the TileMap editor
|
:alt: Placing a scene tile containing particles using the LayeredTileMap editor
|
||||||
|
|
||||||
Placing a scene tile containing particles using the TileMap editor
|
Placing a scene tile containing particles using the LayeredTileMap editor
|
||||||
|
|
||||||
Painting modes and tools
|
Painting modes and tools
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
Using the toolbar at the top of the TileMap editor, you can choose between
|
Using the toolbar at the top of the LayeredTileMap editor, you can choose between
|
||||||
several painting modes and tools. These modes affect operation when clicking in
|
several painting modes and tools. These modes affect operation when clicking in
|
||||||
the 2D editor, **not** the TileMap panel itself.
|
the 2D editor, **not** the LayeredTileMap panel itself.
|
||||||
|
|
||||||
From left to right, the painting modes and tools you can choose are:
|
From left to right, the painting modes and tools you can choose are:
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ To remove from the current selection, hold :kbd:`Ctrl` then select a tile.
|
|||||||
The selection can then be used in any other painting mode to quickly create copies
|
The selection can then be used in any other painting mode to quickly create copies
|
||||||
of an already-placed pattern.
|
of an already-placed pattern.
|
||||||
|
|
||||||
You can remove the selected tiles from the TileMap by pressing :kbd:`Del`.
|
You can remove the selected tiles from the LayeredTileMap by pressing :kbd:`Del`.
|
||||||
|
|
||||||
You can toggle this mode temporarily while in Paint mode by holding :kbd:`Ctrl`
|
You can toggle this mode temporarily while in Paint mode by holding :kbd:`Ctrl`
|
||||||
then performing a selection.
|
then performing a selection.
|
||||||
@ -214,7 +214,7 @@ down the left mouse button.
|
|||||||
If you right-click, the currently selected tile will be erased from the tilemap.
|
If you right-click, the currently selected tile will be erased from the tilemap.
|
||||||
In other words, it will be replaced by empty space.
|
In other words, it will be replaced by empty space.
|
||||||
|
|
||||||
If you have selected multiple tiles in the TileMap or using the Selection tool,
|
If you have selected multiple tiles in the LayeredTileMap or using the Selection tool,
|
||||||
they will be placed every time you click or drag the mouse while holding down
|
they will be placed every time you click or drag the mouse while holding down
|
||||||
the left mouse button.
|
the left mouse button.
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ always 1 tile thick (no matter its orientation).
|
|||||||
|
|
||||||
If you right-click while in Line Paint mode, you will erase in a line.
|
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,
|
If you have selected multiple tiles in the LayeredTileMap or using the Selection tool,
|
||||||
you can place them in a repeating pattern across the line.
|
you can place them in a repeating pattern across the line.
|
||||||
|
|
||||||
You can toggle this mode temporarily while in Paint or Eraser mode by holding
|
You can toggle this mode temporarily while in Paint or Eraser mode by holding
|
||||||
@ -263,7 +263,7 @@ rectangle.
|
|||||||
If you right-click while in Rectangle Paint mode, you will erase in
|
If you right-click while in Rectangle Paint mode, you will erase in
|
||||||
an axis-aligned rectangle.
|
an axis-aligned rectangle.
|
||||||
|
|
||||||
If you have selected multiple tiles in the TileMap or using the Selection tool,
|
If you have selected multiple tiles in the LayeredTileMap or using the Selection tool,
|
||||||
you can place them in a repeating pattern within the rectangle.
|
you can place them in a repeating pattern within the rectangle.
|
||||||
|
|
||||||
You can toggle this mode temporarily while in Paint or Eraser mode by holding
|
You can toggle this mode temporarily while in Paint or Eraser mode by holding
|
||||||
@ -280,15 +280,15 @@ If you enable **Contiguous** (the default), only matching tiles that touch the
|
|||||||
current selection will be replaced. This contiguous check is performed
|
current selection will be replaced. This contiguous check is performed
|
||||||
horizontally and vertically, but *not* diagonally.
|
horizontally and vertically, but *not* diagonally.
|
||||||
|
|
||||||
If you disable **Contiguous**, all tiles with the same ID in the entire TileMap will
|
If you disable **Contiguous**, all tiles with the same ID in the entire LayeredTileMap will
|
||||||
be replaced by the currently selected tile. If selecting an empty tile with
|
be replaced by the currently selected tile. If selecting an empty tile with
|
||||||
**Contiguous** unchecked, all tiles in the rectangle that encompasses the
|
**Contiguous** unchecked, all tiles in the rectangle that encompasses the
|
||||||
TileMap's effective area will be replaced instead.
|
LayeredTileMap's effective area will be replaced instead.
|
||||||
|
|
||||||
If you right-click while in Bucket Fill mode, you will replace matching tiles
|
If you right-click while in Bucket Fill mode, you will replace matching tiles
|
||||||
with empty tiles.
|
with empty tiles.
|
||||||
|
|
||||||
If you have selected multiple tiles in the TileMap or using the Selection tool,
|
If you have selected multiple tiles in the LayeredTileMap or using the Selection tool,
|
||||||
you can place them in a repeating pattern within the filled area.
|
you can place them in a repeating pattern within the filled area.
|
||||||
|
|
||||||
.. figure:: img/using_tilemaps_bucket_fill.webp
|
.. figure:: img/using_tilemaps_bucket_fill.webp
|
||||||
@ -326,12 +326,12 @@ While painting, you can optionally enable *randomization*. When enabled,
|
|||||||
a random tile will be chosen between all the currently selected tiles when
|
a random tile will be chosen between all the currently selected tiles when
|
||||||
painting. This is supported with the Paint, Line, Rectangle and Bucket Fill
|
painting. This is supported with the Paint, Line, Rectangle and Bucket Fill
|
||||||
tools. For effective paint randomization, you must select multiple tiles
|
tools. For effective paint randomization, you must select multiple tiles
|
||||||
in the TileMap editor or use scattering (both approaches can be combined).
|
in the LayeredTileMap editor or use scattering (both approaches can be combined).
|
||||||
|
|
||||||
If **Scattering** is set to a value greater than 0, there is a chance that no tile
|
If **Scattering** is set to a value greater than 0, there is a chance that no tile
|
||||||
will be placed when painting. This can be used to add occasional, non-repeating
|
will be placed when painting. This can be used to add occasional, non-repeating
|
||||||
detail to large areas (such as adding grass or crumbs on a large top-down
|
detail to large areas (such as adding grass or crumbs on a large top-down
|
||||||
TileMap).
|
LayeredTileMap).
|
||||||
|
|
||||||
Example when using Paint mode:
|
Example when using Paint mode:
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ Saving and loading premade tile placements using patterns
|
|||||||
|
|
||||||
While you can copy and paste tiles while in Select mode, you may wish to save
|
While you can copy and paste tiles while in Select mode, you may wish to save
|
||||||
premade *patterns* of tiles to place together in a go. This can be done on a
|
premade *patterns* of tiles to place together in a go. This can be done on a
|
||||||
per-TileMap basis by choosing the **Patterns** tab of the TileMap editor.
|
per-LayeredTileMap basis by choosing the **Patterns** tab of the LayeredTileMap editor.
|
||||||
|
|
||||||
To create a new pattern, switch to Select mode, perform a selection and press
|
To create a new pattern, switch to Select mode, perform a selection and press
|
||||||
:kbd:`Ctrl + C`. Click on empty space within the Patterns tab (a blue focus
|
:kbd:`Ctrl + C`. Click on empty space within the Patterns tab (a blue focus
|
||||||
@ -367,40 +367,40 @@ rectangle should appear around the empty space), then press :kbd:`Ctrl + V`:
|
|||||||
|
|
||||||
.. figure:: img/using_tilemaps_create_pattern.webp
|
.. figure:: img/using_tilemaps_create_pattern.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Creating a new pattern from a selection in the TileMap editor
|
:alt: Creating a new pattern from a selection in the LayeredTileMap editor
|
||||||
|
|
||||||
Creating a new pattern from a selection in the TileMap editor
|
Creating a new pattern from a selection in the LayeredTileMap editor
|
||||||
|
|
||||||
To use an existing pattern, click its image in the **Patterns** tab, switch to
|
To use an existing pattern, click its image in the **Patterns** tab, switch to
|
||||||
any painting mode, then left-click somewhere in the 2D editor:
|
any painting mode, then left-click somewhere in the 2D editor:
|
||||||
|
|
||||||
.. figure:: img/using_tilemaps_use_pattern.webp
|
.. figure:: img/using_tilemaps_use_pattern.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Placing an existing pattern using the TileMap editor
|
:alt: Placing an existing pattern using the LayeredTileMap editor
|
||||||
|
|
||||||
Placing an existing pattern using the TileMap editor
|
Placing an existing pattern using the LayeredTileMap editor
|
||||||
|
|
||||||
Like multi-tile selections, patterns will be repeated if used with the Line,
|
Like multi-tile selections, patterns will be repeated if used with the Line,
|
||||||
Rectangle or Bucket Fill painting modes.
|
Rectangle or Bucket Fill painting modes.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Despite being edited in the TileMap editor, patterns are stored in the
|
Despite being edited in the LayeredTileMap editor, patterns are stored in the
|
||||||
TileSet resource. This allows reusing patterns in different TileMap nodes
|
LayeredTileSet resource. This allows reusing patterns in different LayeredTileMap nodes
|
||||||
after loading a TileSet resource saved to an external file.
|
after loading a LayeredTileSet resource saved to an external file.
|
||||||
|
|
||||||
Handling tile connections automatically using terrains
|
Handling tile connections automatically using terrains
|
||||||
------------------------------------------------------
|
------------------------------------------------------
|
||||||
|
|
||||||
To use terrains, the TileMap node must feature at least one terrain set and a
|
To use terrains, the LayeredTileMap node must feature at least one terrain set and a
|
||||||
terrain within this terrain set. See
|
terrain within this terrain set. See
|
||||||
:ref:`doc_using_tilesets_creating_terrain_sets` if you haven't created a terrain
|
:ref:`doc_using_tilesets_creating_terrain_sets` if you haven't created a terrain
|
||||||
set for the TileSet yet.
|
set for the LayeredTileSet yet.
|
||||||
|
|
||||||
There are 3 kinds of painting modes available for terrain connections:
|
There are 3 kinds of painting modes available for terrain connections:
|
||||||
|
|
||||||
- **Connect**, where tiles are connected to surrounding tiles on the same
|
- **Connect**, where tiles are connected to surrounding tiles on the same
|
||||||
TileMap layer.
|
LayeredTileMap layer.
|
||||||
- **Path**, where tiles are connected to tiles painted in the same stroke (until
|
- **Path**, where tiles are connected to tiles painted in the same stroke (until
|
||||||
the mouse button is released).
|
the mouse button is released).
|
||||||
- Tile-specific overrides to resolve conflicts or handle situations not covered
|
- Tile-specific overrides to resolve conflicts or handle situations not covered
|
||||||
@ -413,24 +413,24 @@ Connect will force both roads to be connected.
|
|||||||
|
|
||||||
.. figure:: img/using_tilemaps_terrain_select_connect_mode.webp
|
.. figure:: img/using_tilemaps_terrain_select_connect_mode.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Selecting Connect mode in the TileMap editor's Terrains tab
|
:alt: Selecting Connect mode in the LayeredTileMap editor's Terrains tab
|
||||||
|
|
||||||
Selecting Connect mode in the TileMap editor's Terrains tab
|
Selecting Connect mode in the LayeredTileMap editor's Terrains tab
|
||||||
|
|
||||||
.. figure:: img/using_tilemaps_terrain_select_path_mode.webp
|
.. figure:: img/using_tilemaps_terrain_select_path_mode.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Selecting Path mode in the TileMap editor's Terrains tab
|
:alt: Selecting Path mode in the LayeredTileMap editor's Terrains tab
|
||||||
|
|
||||||
Selecting Path mode in the TileMap editor's Terrains tab
|
Selecting Path mode in the LayeredTileMap editor's Terrains tab
|
||||||
|
|
||||||
Lastly, you can select specific tiles from the terrain to resolve conflicts in
|
Lastly, you can select specific tiles from the terrain to resolve conflicts in
|
||||||
certain situations:
|
certain situations:
|
||||||
|
|
||||||
.. figure:: img/using_tilemaps_terrain_paint_specific_tiles.webp
|
.. figure:: img/using_tilemaps_terrain_paint_specific_tiles.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Painting with specific tiles in the TileMap editor's Terrains tab
|
:alt: Painting with specific tiles in the LayeredTileMap editor's Terrains tab
|
||||||
|
|
||||||
Painting with specific tiles in the TileMap editor's Terrains tab
|
Painting with specific tiles in the LayeredTileMap editor's Terrains tab
|
||||||
|
|
||||||
Any tile that has at least one of its bits set to a value set to the
|
Any tile that has at least one of its bits set to a value set to the
|
||||||
corresponding terrain ID will appear in the list of tiles to choose from.
|
corresponding terrain ID will appear in the list of tiles to choose from.
|
||||||
@ -438,14 +438,14 @@ corresponding terrain ID will appear in the list of tiles to choose from.
|
|||||||
Handling missing tiles
|
Handling missing tiles
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
If you remove tiles in the TileSet that are referenced in a TileMap, the TileMap
|
If you remove tiles in the LayeredTileSet that are referenced in a LayeredTileMap, the LayeredTileMap
|
||||||
will display a placeholder to indicate that an invalid tile ID is placed:
|
will display a placeholder to indicate that an invalid tile ID is placed:
|
||||||
|
|
||||||
.. figure:: img/using_tilemaps_missing_tiles.webp
|
.. figure:: img/using_tilemaps_missing_tiles.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Missing tiles in the TileMap editor due to the TileSet reference being broken
|
:alt: Missing tiles in the LayeredTileMap editor due to the LayeredTileSet reference being broken
|
||||||
|
|
||||||
Missing tiles in the TileMap editor due to the TileSet reference being broken
|
Missing tiles in the LayeredTileMap editor due to the LayeredTileSet reference being broken
|
||||||
|
|
||||||
These placeholders are **not** visible in the running project, but the tile data
|
These placeholders are **not** visible in the running project, but the tile data
|
||||||
is still persisted to disk. This allows you to safely close and reopen such
|
is still persisted to disk. This allows you to safely close and reopen such
|
||||||
@ -454,5 +454,5 @@ the new tile's appearance.
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Missing tile placeholders may not be visible until you select the TileMap
|
Missing tile placeholders may not be visible until you select the LayeredTileMap
|
||||||
node and open the TileMap editor.
|
node and open the LayeredTileMap editor.
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
.. _doc_using_tilesets:
|
.. _doc_using_tilesets:
|
||||||
|
|
||||||
Using TileSets
|
Using LayeredTileSets
|
||||||
==============
|
==============
|
||||||
|
|
||||||
Introduction
|
Introduction
|
||||||
------------
|
------------
|
||||||
|
|
||||||
A tilemap is a grid of tiles used to create a game's layout. There are several
|
A tilemap is a grid of tiles used to create a game's layout. There are several
|
||||||
benefits to using :ref:`TileMap <class_TileMap>` nodes to design your levels.
|
benefits to using :ref:`LayeredTileMap <class_LayeredTileMap>` nodes to design your levels.
|
||||||
First, they let you draw a layout by "painting" tiles onto a grid,
|
First, they let you draw a layout by "painting" tiles onto a grid,
|
||||||
which is much faster than placing individual :ref:`Sprite2D
|
which is much faster than placing individual :ref:`Sprite2D
|
||||||
<class_Sprite2D>` nodes one by one. Second, they allow for larger levels
|
<class_Sprite2D>` nodes one by one. Second, they allow for larger levels
|
||||||
@ -15,9 +15,9 @@ because they are optimized for drawing large numbers of tiles.
|
|||||||
Finally, they allow you to add greater functionality to your tiles with
|
Finally, they allow you to add greater functionality to your tiles with
|
||||||
collision, occlusion, and navigation shapes.
|
collision, occlusion, and navigation shapes.
|
||||||
|
|
||||||
To use tilemaps, you will need to create a TileSet first. A TileSet is a
|
To use tilemaps, you will need to create a LayeredTileSet first. A LayeredTileSet is a
|
||||||
collection of tiles that can be placed in a TileMap node. After creating a
|
collection of tiles that can be placed in a LayeredTileMap node. After creating a
|
||||||
TileSet, you will be able to place them :ref:`using the TileMap editor
|
LayeredTileSet, you will be able to place them :ref:`using the LayeredTileMap editor
|
||||||
<doc_using_tilemaps>`.
|
<doc_using_tilemaps>`.
|
||||||
|
|
||||||
To follow this guide, you will need an image containing your tiles where every
|
To follow this guide, you will need an image containing your tiles where every
|
||||||
@ -25,7 +25,7 @@ tile has the same size (large objects can be split into several tiles). This
|
|||||||
image is called a *tilesheet*. Tiles do not have to be square: they can be
|
image is called a *tilesheet*. Tiles do not have to be square: they can be
|
||||||
rectangular, hexagonal, or isometric (pseudo-3D perspective).
|
rectangular, hexagonal, or isometric (pseudo-3D perspective).
|
||||||
|
|
||||||
Creating a new TileSet
|
Creating a new LayeredTileSet
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
.. _doc_creating_tilesets_using_tilesheet:
|
.. _doc_creating_tilesets_using_tilesheet:
|
||||||
@ -43,15 +43,15 @@ We'll use this particular *tilesheet* from the set:
|
|||||||
|
|
||||||
Tilesheet with 64×64 tiles. Credit: `Kenney <https://kenney.nl/assets/abstract-platformer>`__
|
Tilesheet with 64×64 tiles. Credit: `Kenney <https://kenney.nl/assets/abstract-platformer>`__
|
||||||
|
|
||||||
Create a new **TileMap** node, then select it and create a new TileSet resource in the inspector:
|
Create a new **LayeredTileMap** node, then select it and create a new LayeredTileSet resource in the inspector:
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_create_new_tileset.webp
|
.. figure:: img/using_tilesets_create_new_tileset.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Creating a new TileSet resource within the TileMap node
|
:alt: Creating a new LayeredTileSet resource within the LayeredTileMap node
|
||||||
|
|
||||||
Creating a new TileSet resource within the TileMap node
|
Creating a new LayeredTileSet resource within the LayeredTileMap node
|
||||||
|
|
||||||
After creating the TileSet resource, click the value to unfold it in the
|
After creating the LayeredTileSet resource, click the value to unfold it in the
|
||||||
inspector. The default tile shape is Square, but you can also choose Isometric,
|
inspector. The default tile shape is Square, but you can also choose Isometric,
|
||||||
Half-Offset Square or Hexagon (depending on the shape of your tile images). If
|
Half-Offset Square or Hexagon (depending on the shape of your tile images). If
|
||||||
using a tile shape other than Square, you may also need to adjust the **Tile
|
using a tile shape other than Square, you may also need to adjust the **Tile
|
||||||
@ -70,17 +70,17 @@ Set the tile size to 64×64 in the inspector to match the example tilesheet:
|
|||||||
|
|
||||||
If relying on automatic tiles creation (like we're about to do here), you must
|
If relying on automatic tiles creation (like we're about to do here), you must
|
||||||
set the tile size **before** creating the *atlas*. The atlas will
|
set the tile size **before** creating the *atlas*. The atlas will
|
||||||
determine which tiles from the tilesheet can be added to a TileMap node
|
determine which tiles from the tilesheet can be added to a LayeredTileMap node
|
||||||
(as not every part of the image may be a valid tile).
|
(as not every part of the image may be a valid tile).
|
||||||
|
|
||||||
Open the **TileSet** panel at the bottom of the editor, then click the "+" icon
|
Open the **LayeredTileSet** panel at the bottom of the editor, then click the "+" icon
|
||||||
in the bottom-left corner to add a new atlas:
|
in the bottom-left corner to add a new atlas:
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_create_new_atlas.webp
|
.. figure:: img/using_tilesets_create_new_atlas.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Creating a new atlas in a TileSet resource using the bottom panel
|
:alt: Creating a new atlas in a LayeredTileSet resource using the bottom panel
|
||||||
|
|
||||||
Creating a new atlas in a TileSet resource using the bottom panel
|
Creating a new atlas in a LayeredTileSet resource using the bottom panel
|
||||||
|
|
||||||
After creating an atlas, you must assign a tilesheet texture to it.
|
After creating an atlas, you must assign a tilesheet texture to it.
|
||||||
This can be done by choosing it on the left column of the bottom panel, then
|
This can be done by choosing it on the left column of the bottom panel, then
|
||||||
@ -89,9 +89,9 @@ Specify the path to the image file using the file dialog that appears.
|
|||||||
|
|
||||||
.. figure:: img/using_tilesets_load_tilesheet.webp
|
.. figure:: img/using_tilesets_load_tilesheet.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Loading a tilesheet image in the newly created TileSet atlas
|
:alt: Loading a tilesheet image in the newly created LayeredTileSet atlas
|
||||||
|
|
||||||
Loading a tilesheet image in the newly created TileSet atlas
|
Loading a tilesheet image in the newly created LayeredTileSet atlas
|
||||||
|
|
||||||
After specifying a valid image, you will be asked whether to create tiles
|
After specifying a valid image, you will be asked whether to create tiles
|
||||||
automatically. Answer **Yes**:
|
automatically. Answer **Yes**:
|
||||||
@ -103,7 +103,7 @@ automatically. Answer **Yes**:
|
|||||||
Automatically creating tiles based on tilesheet image content
|
Automatically creating tiles based on tilesheet image content
|
||||||
|
|
||||||
This will automatically create tiles according to the tile size you specified
|
This will automatically create tiles according to the tile size you specified
|
||||||
earlier in the TileSet resource. This greatly speeds up initial tile setup.
|
earlier in the LayeredTileSet resource. This greatly speeds up initial tile setup.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@ -116,20 +116,20 @@ you wish to remove:
|
|||||||
|
|
||||||
.. figure:: img/using_tilesets_eraser_tool.webp
|
.. figure:: img/using_tilesets_eraser_tool.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Using the Eraser tool to remove unwanted tiles from the TileSet atlas
|
:alt: Using the Eraser tool to remove unwanted tiles from the LayeredTileSet atlas
|
||||||
|
|
||||||
Using the Eraser tool to remove unwanted tiles from the TileSet atlas
|
Using the Eraser tool to remove unwanted tiles from the LayeredTileSet atlas
|
||||||
|
|
||||||
You can also right-click a tile and choose **Delete**, as an alternative to the
|
You can also right-click a tile and choose **Delete**, as an alternative to the
|
||||||
Eraser tool.
|
Eraser tool.
|
||||||
|
|
||||||
.. tip::
|
.. tip::
|
||||||
|
|
||||||
Like in the 2D and TileMap editors, you can pan across the TileSet panel using
|
Like in the 2D and LayeredTileMap editors, you can pan across the LayeredTileSet panel using
|
||||||
the middle or right mouse buttons, and zoom using the mouse wheel or buttons in
|
the middle or right mouse buttons, and zoom using the mouse wheel or buttons in
|
||||||
the top-left corner.
|
the top-left corner.
|
||||||
|
|
||||||
If you wish to source tiles from several tilesheet images for a single TileSet,
|
If you wish to source tiles from several tilesheet images for a single LayeredTileSet,
|
||||||
create additional atlases and assign textures to each of them before continuing.
|
create additional atlases and assign textures to each of them before continuing.
|
||||||
It is also possible to use one image per tile this way (although using
|
It is also possible to use one image per tile this way (although using
|
||||||
tilesheets is recommended for better usability).
|
tilesheets is recommended for better usability).
|
||||||
@ -138,13 +138,13 @@ You can adjust properties for the atlas in the middle column:
|
|||||||
|
|
||||||
.. figure:: img/using_tilesets_properties.webp
|
.. figure:: img/using_tilesets_properties.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Adjusting TileSet atlas properties in the dedicated inspector (part of the TileSet panel)
|
:alt: Adjusting LayeredTileSet atlas properties in the dedicated inspector (part of the LayeredTileSet panel)
|
||||||
|
|
||||||
Adjusting TileSet atlas properties in the dedicated inspector (part of the TileSet panel)
|
Adjusting LayeredTileSet atlas properties in the dedicated inspector (part of the LayeredTileSet panel)
|
||||||
|
|
||||||
The following properties can be adjusted on the atlas:
|
The following properties can be adjusted on the atlas:
|
||||||
|
|
||||||
- **ID:** The identifier (unique within this TileSet), used for sorting.
|
- **ID:** The identifier (unique within this LayeredTileSet), used for sorting.
|
||||||
- **Name:** The human-readable name for the atlas. Use a descriptive name
|
- **Name:** The human-readable name for the atlas. Use a descriptive name
|
||||||
here for organizational purposes (such as "terrain", "decoration", etc).
|
here for organizational purposes (such as "terrain", "decoration", etc).
|
||||||
- **Margins:** The margins on the image's edges that should not be selectable as
|
- **Margins:** The margins on the image's edges that should not be selectable as
|
||||||
@ -154,7 +154,7 @@ The following properties can be adjusted on the atlas:
|
|||||||
Increasing this can be useful if the tilesheet image you're using contains
|
Increasing this can be useful if the tilesheet image you're using contains
|
||||||
guides (such as outlines between every tile).
|
guides (such as outlines between every tile).
|
||||||
- **Texture Region Size:** The size of each tile on the atlas in pixels. In most
|
- **Texture Region Size:** The size of each tile on the atlas in pixels. In most
|
||||||
cases, this should match the tile size defined in the TileMap property
|
cases, this should match the tile size defined in the LayeredTileMap property
|
||||||
(although this is not strictly necessary).
|
(although this is not strictly necessary).
|
||||||
- **Use Texture Padding:** If checked, adds a 1-pixel transparent edge around
|
- **Use Texture Padding:** If checked, adds a 1-pixel transparent edge around
|
||||||
each tile to prevent texture bleeding when filtering is enabled.
|
each tile to prevent texture bleeding when filtering is enabled.
|
||||||
@ -164,7 +164,7 @@ The following properties can be adjusted on the atlas:
|
|||||||
Note that changing texture margin, separation and region size may cause tiles to
|
Note that changing texture margin, separation and region size may cause tiles to
|
||||||
be lost (as some of them would be located outside the atlas image's
|
be lost (as some of them would be located outside the atlas image's
|
||||||
coordinates). To regenerate tiles automatically from the tilesheet, use the
|
coordinates). To regenerate tiles automatically from the tilesheet, use the
|
||||||
three vertical dots menu button at the top of the TileSet editor and choose
|
three vertical dots menu button at the top of the LayeredTileSet editor and choose
|
||||||
**Create Tiles in Non-Transparent Texture Regions**:
|
**Create Tiles in Non-Transparent Texture Regions**:
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_recreate_tiles_automatically.webp
|
.. figure:: img/using_tilesets_recreate_tiles_automatically.webp
|
||||||
@ -193,14 +193,14 @@ sounds), particle effects, and more.
|
|||||||
|
|
||||||
For this example, we'll create a scene containing a CPUParticles2D root node.
|
For this example, we'll create a scene containing a CPUParticles2D root node.
|
||||||
Save this scene to a scene file (separate from the scene containing the
|
Save this scene to a scene file (separate from the scene containing the
|
||||||
TileMap), then switch to the scene containing the TileMap node. Open the TileSet
|
LayeredTileMap), then switch to the scene containing the LayeredTileMap node. Open the LayeredTileSet
|
||||||
editor, and create a new **Scenes Collection** in the left column:
|
editor, and create a new **Scenes Collection** in the left column:
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_creating_scene_collection.webp
|
.. figure:: img/using_tilesets_creating_scene_collection.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Creating a scenes collection in the TileSet editor
|
:alt: Creating a scenes collection in the LayeredTileSet editor
|
||||||
|
|
||||||
Creating a scenes collection in the TileSet editor
|
Creating a scenes collection in the LayeredTileSet editor
|
||||||
|
|
||||||
After creating a scenes collection, you can enter a descriptive name for the
|
After creating a scenes collection, you can enter a descriptive name for the
|
||||||
scenes collection in the middle column if you wish. Select this scenes
|
scenes collection in the middle column if you wish. Select this scenes
|
||||||
@ -208,32 +208,32 @@ collection then create a new scene slot:
|
|||||||
|
|
||||||
.. figure:: img/using_tilesets_scene_collection_create_scene_tile.webp
|
.. figure:: img/using_tilesets_scene_collection_create_scene_tile.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Creating a scene tile after selecting the scenes collection in the TileSet editor
|
:alt: Creating a scene tile after selecting the scenes collection in the LayeredTileSet editor
|
||||||
|
|
||||||
Creating a scene tile after selecting the scenes collection in the TileSet editor
|
Creating a scene tile after selecting the scenes collection in the LayeredTileSet editor
|
||||||
|
|
||||||
Select this scene slot in the right column, then use **Quick Load** (or
|
Select this scene slot in the right column, then use **Quick Load** (or
|
||||||
**Load**) to load the scene file containing the particles:
|
**Load**) to load the scene file containing the particles:
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_adding_scene_tile.webp
|
.. figure:: img/using_tilesets_adding_scene_tile.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Creating a scene slot, then loading a scene file into it in the TileSet editor
|
:alt: Creating a scene slot, then loading a scene file into it in the LayeredTileSet editor
|
||||||
|
|
||||||
Creating a scene slot, then loading a scene file into it in the TileSet editor
|
Creating a scene slot, then loading a scene file into it in the LayeredTileSet editor
|
||||||
|
|
||||||
You now have a scene tile in your TileSet. Once you switch to the TileMap
|
You now have a scene tile in your LayeredTileSet. Once you switch to the LayeredTileMap
|
||||||
editor, you'll be able to select it from the scenes collection and paint it like
|
editor, you'll be able to select it from the scenes collection and paint it like
|
||||||
any other tile.
|
any other tile.
|
||||||
|
|
||||||
Merging several atlases into a single atlas
|
Merging several atlases into a single atlas
|
||||||
-------------------------------------------
|
-------------------------------------------
|
||||||
|
|
||||||
Using multiple atlases within a single TileSet resource can sometimes be useful,
|
Using multiple atlases within a single LayeredTileSet resource can sometimes be useful,
|
||||||
but it can also be cumbersome in certain situations (especially if you're using
|
but it can also be cumbersome in certain situations (especially if you're using
|
||||||
one image per tile). Godot allows you to merge several atlases into a single
|
one image per tile). Godot allows you to merge several atlases into a single
|
||||||
atlas for easier organization.
|
atlas for easier organization.
|
||||||
|
|
||||||
To do so, you must have more than one atlas created in the TileSet resource.
|
To do so, you must have more than one atlas created in the LayeredTileSet resource.
|
||||||
Use the "three vertical dots" menu button located at the bottom of the list of
|
Use the "three vertical dots" menu button located at the bottom of the list of
|
||||||
atlases, then choose **Open Atlas Merging Tool**:
|
atlases, then choose **Open Atlas Merging Tool**:
|
||||||
|
|
||||||
@ -253,15 +253,15 @@ This will open a dialog, in which you can select several atlases by holding
|
|||||||
Using the atlas merging tool dialog
|
Using the atlas merging tool dialog
|
||||||
|
|
||||||
Choose **Merge** to merge the selected atlases into a single atlas image (which
|
Choose **Merge** to merge the selected atlases into a single atlas image (which
|
||||||
translates to a single atlas within the TileSet). The unmerged atlases will be
|
translates to a single atlas within the LayeredTileSet). The unmerged atlases will be
|
||||||
removed within the TileSet, but *the original tilesheet images will be kept on
|
removed within the LayeredTileSet, but *the original tilesheet images will be kept on
|
||||||
the filesystem*. If you don't want the unmerged atlases to be removed from the
|
the filesystem*. If you don't want the unmerged atlases to be removed from the
|
||||||
TileSet resource, choose **Merge (Keep Original Atlases)** instead.
|
LayeredTileSet resource, choose **Merge (Keep Original Atlases)** instead.
|
||||||
|
|
||||||
.. tip::
|
.. tip::
|
||||||
|
|
||||||
TileSet features a system of *tile proxies*. Tile proxies are a mapping
|
LayeredTileSet features a system of *tile proxies*. Tile proxies are a mapping
|
||||||
table that allows notifying the TileMap using a given TileSet that a given
|
table that allows notifying the LayeredTileMap using a given LayeredTileSet that a given
|
||||||
set of tile identifiers should be replaced by another one.
|
set of tile identifiers should be replaced by another one.
|
||||||
|
|
||||||
Tile proxies are automatically set up when merging different atlases, but
|
Tile proxies are automatically set up when merging different atlases, but
|
||||||
@ -270,14 +270,14 @@ TileSet resource, choose **Merge (Keep Original Atlases)** instead.
|
|||||||
|
|
||||||
Manually creating tile proxies may be useful when you changed an atlas ID or
|
Manually creating tile proxies may be useful when you changed an atlas ID or
|
||||||
want to replace all tiles from an atlas by the ones from another atlas. Note
|
want to replace all tiles from an atlas by the ones from another atlas. Note
|
||||||
that when editing a TileMap, you can replace all cells by their
|
that when editing a LayeredTileMap, you can replace all cells by their
|
||||||
corresponding mapped value.
|
corresponding mapped value.
|
||||||
|
|
||||||
Adding collision, navigation and occlusion to the TileSet
|
Adding collision, navigation and occlusion to the LayeredTileSet
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
|
|
||||||
We've now successfully created a basic TileSet. We could start using in the
|
We've now successfully created a basic LayeredTileSet. We could start using in the
|
||||||
TileMap node now, but it currently lacks any form of collision detection.
|
LayeredTileMap node now, but it currently lacks any form of collision detection.
|
||||||
This means the player and other objects could walk straight through the floor or
|
This means the player and other objects could walk straight through the floor or
|
||||||
walls.
|
walls.
|
||||||
|
|
||||||
@ -286,36 +286,36 @@ to define navigation polygons for tiles to generate a navigation mesh that
|
|||||||
agents can use for pathfinding.
|
agents can use for pathfinding.
|
||||||
|
|
||||||
Lastly, if you use :ref:`doc_2d_lights_and_shadows` or GPUParticles2D, you may
|
Lastly, if you use :ref:`doc_2d_lights_and_shadows` or GPUParticles2D, you may
|
||||||
also want your TileSet to be able to cast shadows and collide with particles.
|
also want your LayeredTileSet to be able to cast shadows and collide with particles.
|
||||||
This requires defining occluder polygons for "solid" tiles on the TileSet.
|
This requires defining occluder polygons for "solid" tiles on the LayeredTileSet.
|
||||||
|
|
||||||
To be able to define collision, navigation and occlusion shapes for each tile,
|
To be able to define collision, navigation and occlusion shapes for each tile,
|
||||||
you will need to create a physics, navigation or occlusion layer for the TileSet
|
you will need to create a physics, navigation or occlusion layer for the LayeredTileSet
|
||||||
resource first. To do so, select the TileMap node, click the TileSet property
|
resource first. To do so, select the LayeredTileMap node, click the LayeredTileSet property
|
||||||
value in the inspector to edit it then unfold **Physics Layers** and choose
|
value in the inspector to edit it then unfold **Physics Layers** and choose
|
||||||
**Add Element**:
|
**Add Element**:
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_create_physics_layer.webp
|
.. figure:: img/using_tilesets_create_physics_layer.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Creating a physics layer in the TileSet resource inspector (within the TileMap node)
|
:alt: Creating a physics layer in the LayeredTileSet resource inspector (within the LayeredTileMap node)
|
||||||
|
|
||||||
Creating a physics layer in the TileSet resource inspector (within the TileMap node)
|
Creating a physics layer in the LayeredTileSet resource inspector (within the LayeredTileMap node)
|
||||||
|
|
||||||
If you also need navigation support, now is a good time to create a navigation layer:
|
If you also need navigation support, now is a good time to create a navigation layer:
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_create_navigation_layer.webp
|
.. figure:: img/using_tilesets_create_navigation_layer.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Creating a navigation layer in the TileSet resource inspector (within the TileMap node)
|
:alt: Creating a navigation layer in the LayeredTileSet resource inspector (within the LayeredTileMap node)
|
||||||
|
|
||||||
Creating a navigation layer in the TileSet resource inspector (within the TileMap node)
|
Creating a navigation layer in the LayeredTileSet resource inspector (within the LayeredTileMap node)
|
||||||
|
|
||||||
If you need support for light polygon occluders, now is a good time to create an occlusion layer:
|
If you need support for light polygon occluders, now is a good time to create an occlusion layer:
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_create_occlusion_layer.webp
|
.. figure:: img/using_tilesets_create_occlusion_layer.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Creating an occlusion layer in the TileSet resource inspector (within the TileMap node)
|
:alt: Creating an occlusion layer in the LayeredTileSet resource inspector (within the LayeredTileMap node)
|
||||||
|
|
||||||
Creating an occlusion layer in the TileSet resource inspector (within the TileMap node)
|
Creating an occlusion layer in the LayeredTileSet resource inspector (within the LayeredTileMap node)
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ If you need support for light polygon occluders, now is a good time to create an
|
|||||||
section so you can edit the polygon.
|
section so you can edit the polygon.
|
||||||
|
|
||||||
After creating a physics layer, you have access to the **Physics Layer** section
|
After creating a physics layer, you have access to the **Physics Layer** section
|
||||||
in the TileSet atlas inspector:
|
in the LayeredTileSet atlas inspector:
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_selecting_collision_editor.webp
|
.. figure:: img/using_tilesets_selecting_collision_editor.webp
|
||||||
:align: center
|
:align: center
|
||||||
@ -338,7 +338,7 @@ in the TileSet atlas inspector:
|
|||||||
Opening the collision editor while in Select mode
|
Opening the collision editor while in Select mode
|
||||||
|
|
||||||
You can quickly create a rectangle collision shape by pressing :kbd:`F` while
|
You can quickly create a rectangle collision shape by pressing :kbd:`F` while
|
||||||
the TileSet editor is focused. If the keyboard shortcut doesn't work, try
|
the LayeredTileSet editor is focused. If the keyboard shortcut doesn't work, try
|
||||||
clicking in the empty area around the polygon editor to focus it:
|
clicking in the empty area around the polygon editor to focus it:
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_using_default_rectangle_collision.webp
|
.. figure:: img/using_tilesets_using_default_rectangle_collision.webp
|
||||||
@ -378,13 +378,13 @@ You can also use the rectangle as a base for more complex shapes by adding more
|
|||||||
.. tip::
|
.. tip::
|
||||||
|
|
||||||
If you have a large tileset, specifying the collision for each tile
|
If you have a large tileset, specifying the collision for each tile
|
||||||
individually could take a lot of time. This is especially true as TileMaps
|
individually could take a lot of time. This is especially true as LayeredTileMaps
|
||||||
tend to have many tiles with common collision patterns (such as solid blocks
|
tend to have many tiles with common collision patterns (such as solid blocks
|
||||||
or 45-degree slopes). To apply a similar collision shape to several tiles
|
or 45-degree slopes). To apply a similar collision shape to several tiles
|
||||||
quickly, use functionality to
|
quickly, use functionality to
|
||||||
:ref:`assign properties to multiple tiles at once <doc_using_tilemaps_assigning_properties_to_multiple_tiles>`.
|
:ref:`assign properties to multiple tiles at once <doc_using_tilemaps_assigning_properties_to_multiple_tiles>`.
|
||||||
|
|
||||||
Assigning custom metadata to the TileSet's tiles
|
Assigning custom metadata to the LayeredTileSet's tiles
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
|
|
||||||
You can assign custom data on a per-tile basis using *custom data layers*.
|
You can assign custom data on a per-tile basis using *custom data layers*.
|
||||||
@ -392,7 +392,7 @@ This can be useful to store information specific to your game, such as the damag
|
|||||||
that a tile should deal when the player touches it, or whether a tile can be
|
that a tile should deal when the player touches it, or whether a tile can be
|
||||||
destroyed using a weapon.
|
destroyed using a weapon.
|
||||||
|
|
||||||
The data is associated with the tile in the TileSet: all instances of the placed
|
The data is associated with the tile in the LayeredTileSet: all instances of the placed
|
||||||
tile will use the same custom data. If you need to create a variant of a tile
|
tile will use the same custom data. If you need to create a variant of a tile
|
||||||
that has different custom data, this can be done by :ref:`creating an
|
that has different custom data, this can be done by :ref:`creating an
|
||||||
alternative tile <doc_using_tilesets_creating_alternative_tiles>` and changing
|
alternative tile <doc_using_tilesets_creating_alternative_tiles>` and changing
|
||||||
@ -400,9 +400,9 @@ the custom data for the alternative tile only.
|
|||||||
|
|
||||||
.. figure:: img/using_tilesets_create_custom_data_layer.webp
|
.. figure:: img/using_tilesets_create_custom_data_layer.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Creating a custom data layer in the TileSet resource inspector (within the TileMap node)
|
:alt: Creating a custom data layer in the LayeredTileSet resource inspector (within the LayeredTileMap node)
|
||||||
|
|
||||||
Creating a custom data layer in the TileSet resource inspector (within the TileMap node)
|
Creating a custom data layer in the LayeredTileSet resource inspector (within the LayeredTileMap node)
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_custom_data_layers_example.webp
|
.. figure:: img/using_tilesets_custom_data_layers_example.webp
|
||||||
:align: center
|
:align: center
|
||||||
@ -410,7 +410,7 @@ the custom data for the alternative tile only.
|
|||||||
|
|
||||||
Example of configured custom data layers with game-specific properties
|
Example of configured custom data layers with game-specific properties
|
||||||
|
|
||||||
You can reorder custom data without breaking existing metadata: the TileSet
|
You can reorder custom data without breaking existing metadata: the LayeredTileSet
|
||||||
editor will update automatically after reordering custom data properties.
|
editor will update automatically after reordering custom data properties.
|
||||||
|
|
||||||
Note that in the editor, property names do not appear (only their index, which
|
Note that in the editor, property names do not appear (only their index, which
|
||||||
@ -421,18 +421,18 @@ to ``false``:
|
|||||||
|
|
||||||
.. figure:: img/using_tilesets_edit_custom_data.webp
|
.. figure:: img/using_tilesets_edit_custom_data.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Editing custom data in the TileSet editor while in Select mode
|
:alt: Editing custom data in the LayeredTileSet editor while in Select mode
|
||||||
|
|
||||||
Editing custom data in the TileSet editor while in Select mode
|
Editing custom data in the LayeredTileSet editor while in Select mode
|
||||||
|
|
||||||
:ref:`Tile property painting <doc_using_tilemaps_using_tile_property_painting>`
|
:ref:`Tile property painting <doc_using_tilemaps_using_tile_property_painting>`
|
||||||
can also be used for custom data:
|
can also be used for custom data:
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_paint_custom_data.webp
|
.. figure:: img/using_tilesets_paint_custom_data.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Assigning custom data in the TileSet editor using tile property painting
|
:alt: Assigning custom data in the LayeredTileSet editor using tile property painting
|
||||||
|
|
||||||
Assigning custom data in the TileSet editor using tile property painting
|
Assigning custom data in the LayeredTileSet editor using tile property painting
|
||||||
|
|
||||||
.. _doc_using_tilesets_creating_terrain_sets:
|
.. _doc_using_tilesets_creating_terrain_sets:
|
||||||
|
|
||||||
@ -448,7 +448,7 @@ Creating terrain sets (autotiling)
|
|||||||
|
|
||||||
Unlike before, where autotiles were a specific kind of tiles, terrains are
|
Unlike before, where autotiles were a specific kind of tiles, terrains are
|
||||||
only a set of properties assigned to atlas tiles. These properties are then
|
only a set of properties assigned to atlas tiles. These properties are then
|
||||||
used by a dedicated TileMap painting mode that selects tiles featuring
|
used by a dedicated LayeredTileMap painting mode that selects tiles featuring
|
||||||
terrain data in a smart way. This means any terrain tile can be either
|
terrain data in a smart way. This means any terrain tile can be either
|
||||||
painted as terrain or as a single tile, like any other.
|
painted as terrain or as a single tile, like any other.
|
||||||
|
|
||||||
@ -470,13 +470,13 @@ terrains are matched to each other in a terrain set.
|
|||||||
Godot 3.x: 2×2, 3×3 or 3×3 minimal. This is also similar to what
|
Godot 3.x: 2×2, 3×3 or 3×3 minimal. This is also similar to what
|
||||||
the `Tiled <https://www.mapeditor.org/>`__ editor features.
|
the `Tiled <https://www.mapeditor.org/>`__ editor features.
|
||||||
|
|
||||||
Select the TileMap node, go to the inspector and create a new terrain set within the TileSet *resource*:
|
Select the LayeredTileMap node, go to the inspector and create a new terrain set within the LayeredTileSet *resource*:
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_create_terrain_set.webp
|
.. figure:: img/using_tilesets_create_terrain_set.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Creating a terrain set in the TileSet resource inspector (within the TileMap node)
|
:alt: Creating a terrain set in the LayeredTileSet resource inspector (within the LayeredTileMap node)
|
||||||
|
|
||||||
Creating a terrain set in the TileSet resource inspector (within the TileMap node)
|
Creating a terrain set in the LayeredTileSet resource inspector (within the LayeredTileMap node)
|
||||||
|
|
||||||
After creating a terrain set, you **must** create one or more terrains *within* the terrain set:
|
After creating a terrain set, you **must** create one or more terrains *within* the terrain set:
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ After creating a terrain set, you **must** create one or more terrains *within*
|
|||||||
|
|
||||||
Creating a terrain within the terrain set
|
Creating a terrain within the terrain set
|
||||||
|
|
||||||
In the TileSet editor, switch to Select mode and click a tile. In the middle
|
In the LayeredTileSet editor, switch to Select mode and click a tile. In the middle
|
||||||
column, unfold the **Terrains** section then assign a terrain set ID and a
|
column, unfold the **Terrains** section then assign a terrain set ID and a
|
||||||
terrain ID for the tile. ``-1`` means "no terrain set" or "no terrain", which
|
terrain ID for the tile. ``-1`` means "no terrain set" or "no terrain", which
|
||||||
means you must set **Terrain Set** to ``0`` or greater before you can set
|
means you must set **Terrain Set** to ``0`` or greater before you can set
|
||||||
@ -499,9 +499,9 @@ means you must set **Terrain Set** to ``0`` or greater before you can set
|
|||||||
|
|
||||||
.. figure:: img/using_tilesets_configure_terrain_on_tile.webp
|
.. figure:: img/using_tilesets_configure_terrain_on_tile.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Configuring terrain on a single tile in the TileSet editor's Select mode
|
:alt: Configuring terrain on a single tile in the LayeredTileSet editor's Select mode
|
||||||
|
|
||||||
Configuring terrain on a single tile in the TileSet editor's Select mode
|
Configuring terrain on a single tile in the LayeredTileSet editor's Select mode
|
||||||
|
|
||||||
After doing so, you can now configure the **Terrain Peering Bits** section which
|
After doing so, you can now configure the **Terrain Peering Bits** section which
|
||||||
becomes visible in the middle column. The peering bits determine which tile will
|
becomes visible in the middle column. The peering bits determine which tile will
|
||||||
@ -516,9 +516,9 @@ if there is empty space on top of it (including diagonally).
|
|||||||
|
|
||||||
.. figure:: img/using_tilesets_configure_terrain_peering_bits.webp
|
.. figure:: img/using_tilesets_configure_terrain_peering_bits.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Configuring terrain peering bits on a single tile in the TileSet editor's Select mode
|
:alt: Configuring terrain peering bits on a single tile in the LayeredTileSet editor's Select mode
|
||||||
|
|
||||||
Configuring terrain peering bits on a single tile in the TileSet editor's Select mode
|
Configuring terrain peering bits on a single tile in the LayeredTileSet editor's Select mode
|
||||||
|
|
||||||
An example configuration for a full tilesheet may look as follows:
|
An example configuration for a full tilesheet may look as follows:
|
||||||
|
|
||||||
@ -546,7 +546,7 @@ Using multiple tile selection
|
|||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
If you wish to configure various properties on several times at once,
|
If you wish to configure various properties on several times at once,
|
||||||
choose the **Select** mode at the top of the TileSet editor:
|
choose the **Select** mode at the top of the LayeredTileSet editor:
|
||||||
|
|
||||||
After doing this, you can select multiple tiles on the right column by holding
|
After doing this, you can select multiple tiles on the right column by holding
|
||||||
:kbd:`Shift` then clicking on tiles. You can also perform rectangle selection by
|
:kbd:`Shift` then clicking on tiles. You can also perform rectangle selection by
|
||||||
@ -555,7 +555,7 @@ deselect tiles that were already selected (without affecting the rest of the
|
|||||||
selection) by holding :kbd:`Shift` then clicking on a selected tile.
|
selection) by holding :kbd:`Shift` then clicking on a selected tile.
|
||||||
|
|
||||||
You can then assign properties using the inspector in the middle column of the
|
You can then assign properties using the inspector in the middle column of the
|
||||||
TileSet editor. Only properties that you change here will be applied to all
|
LayeredTileSet editor. Only properties that you change here will be applied to all
|
||||||
selected tiles. Like in the editor's inspector, properties that differ on
|
selected tiles. Like in the editor's inspector, properties that differ on
|
||||||
selected tiles will remain different until you edit them.
|
selected tiles will remain different until you edit them.
|
||||||
|
|
||||||
@ -582,9 +582,9 @@ to "paint" properties onto tiles.
|
|||||||
|
|
||||||
.. figure:: img/using_tilesets_paint_tile_properties.webp
|
.. figure:: img/using_tilesets_paint_tile_properties.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Painting tile properties using the TileSet editor
|
:alt: Painting tile properties using the LayeredTileSet editor
|
||||||
|
|
||||||
Painting tile properties using the TileSet editor
|
Painting tile properties using the LayeredTileSet editor
|
||||||
|
|
||||||
Tile property painting is especially useful with properties that are
|
Tile property painting is especially useful with properties that are
|
||||||
time-consuming to set manually, such as collision shapes:
|
time-consuming to set manually, such as collision shapes:
|
||||||
@ -609,17 +609,17 @@ can be done using *alternative tiles*.
|
|||||||
|
|
||||||
Since Godot 4.2, you don't have to create alternative tiles to rotate or
|
Since Godot 4.2, you don't have to create alternative tiles to rotate or
|
||||||
flip tiles anymore. You can rotate any tile while placing it in the
|
flip tiles anymore. You can rotate any tile while placing it in the
|
||||||
TileMap editor by using the rotation/flip buttons in the TileMap editor
|
LayeredTileMap editor by using the rotation/flip buttons in the LayeredTileMap editor
|
||||||
toolbar.
|
toolbar.
|
||||||
|
|
||||||
To create an alternative tile, right-click a base tile in the atlas displayed by
|
To create an alternative tile, right-click a base tile in the atlas displayed by
|
||||||
the TileSet editor, then choose **Create an Alternative Tile**:
|
the LayeredTileSet editor, then choose **Create an Alternative Tile**:
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_create_alternative_tile.webp
|
.. figure:: img/using_tilesets_create_alternative_tile.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Creating an alternative tile by right-clicking a base tile in the TileSet editor
|
:alt: Creating an alternative tile by right-clicking a base tile in the LayeredTileSet editor
|
||||||
|
|
||||||
Creating an alternative tile by right-clicking a base tile in the TileSet editor
|
Creating an alternative tile by right-clicking a base tile in the LayeredTileSet editor
|
||||||
|
|
||||||
If currently in Select mode, the alternative tile will already be selected
|
If currently in Select mode, the alternative tile will already be selected
|
||||||
for editing. If not currently in Select mode, you can still create alternative
|
for editing. If not currently in Select mode, you can still create alternative
|
||||||
@ -628,20 +628,20 @@ tile to edit it.
|
|||||||
|
|
||||||
If you don't see the alternative tile, pan over to the right of the atlas image,
|
If you don't see the alternative tile, pan over to the right of the atlas image,
|
||||||
as alternative tiles always appear on the right of base tiles of a given atlas
|
as alternative tiles always appear on the right of base tiles of a given atlas
|
||||||
in the TileSet editor:
|
in the LayeredTileSet editor:
|
||||||
|
|
||||||
.. figure:: img/using_tilesets_configure_alternative_tile.webp
|
.. figure:: img/using_tilesets_configure_alternative_tile.webp
|
||||||
:align: center
|
:align: center
|
||||||
:alt: Configuring an alternative tile after clicking it in the TileSet editor
|
:alt: Configuring an alternative tile after clicking it in the LayeredTileSet editor
|
||||||
|
|
||||||
Configuring an alternative tile after clicking it in the TileSet editor
|
Configuring an alternative tile after clicking it in the LayeredTileSet editor
|
||||||
|
|
||||||
After selecting an alternative tile, you can change any properties using the
|
After selecting an alternative tile, you can change any properties using the
|
||||||
middle column like you would on a base tile. However, the list of exposed
|
middle column like you would on a base tile. However, the list of exposed
|
||||||
properties is different compared to base tiles:
|
properties is different compared to base tiles:
|
||||||
|
|
||||||
- **Alternative ID:** The unique numerical identifier for this alternative tile.
|
- **Alternative ID:** The unique numerical identifier for this alternative tile.
|
||||||
Changing it will break existing TileMaps, so be careful! This ID also controls
|
Changing it will break existing LayeredTileMaps, so be careful! This ID also controls
|
||||||
the sorting in the list of alternative tiles displayed in the editor.
|
the sorting in the list of alternative tiles displayed in the editor.
|
||||||
- **Rendering > Flip H:** If ``true``, the tile is horizontally flipped.
|
- **Rendering > Flip H:** If ``true``, the tile is horizontally flipped.
|
||||||
- **Rendering > Flip V:** If ``true``, the tile is vertically flipped.
|
- **Rendering > Flip V:** If ``true``, the tile is vertically flipped.
|
||||||
@ -662,7 +662,7 @@ properties is different compared to base tiles:
|
|||||||
coordinate (in pixels). This allows using layers as if they were on different
|
coordinate (in pixels). This allows using layers as if they were on different
|
||||||
height for top-down games. Adjusting this can help alleviate issues with
|
height for top-down games. Adjusting this can help alleviate issues with
|
||||||
sorting certain tiles. Only effective if **Y Sort Enabled** is ``true`` on
|
sorting certain tiles. Only effective if **Y Sort Enabled** is ``true`` on
|
||||||
the TileMap layer the tile is placed on.
|
the LayeredTileMap layer the tile is placed on.
|
||||||
|
|
||||||
You can create an additional alternative tile variant by clicking the large "+"
|
You can create an additional alternative tile variant by clicking the large "+"
|
||||||
icon next to the alternative tile. This is equivalent to selecting the base tile
|
icon next to the alternative tile. This is equivalent to selecting the base tile
|
||||||
|
Loading…
Reference in New Issue
Block a user