Tile maps
Tile maps: solid, one-way, animated and light-blocking tiles, one voxel collider, autotiling from a rule table, isometric and hex, Tiled and LDtk import.
Na tej stronie
A tilemap node draws a grid of cells over a tileset.
- The tileset says what each tile is: solid, one-way, animated, light-blocking.
- The map builds the collider, resolves its tiles from the painted terrain, and casts the shadows.
Collision
- The tileset marks solid tiles. A
tile_collisioncomponent builds one parry voxel shape from them. - Slopes are polygons in tile pixels.
one_way = truemakes a platform.
[tiles.0]
collision = "full"
[tiles.7]
collision = [[[0, 16], [16, 16], [16, 8]]] # a slope, in tile pixels
one_way = true
set_cell marks the map. The collider is rebuilt once on the next fixed step,
however many cells changed.
Autotiling
A painted terrain resolves through one table of [[rules]], read in order.
The first match wins.
[[rules]]
terrain = "grass"
pattern = ["?#?", # ? any # this terrain . anything else
"?#.",
"?##"]
tile = 12
transforms = ["rotate", "mirror"]
outside = "same"
transformslets one rule cover eight orientations. A 47-tile blob is a dozen rules.outsidesays whether the edge of the map counts as the same terrain.- Variation is hashed from the cell's coordinate. A map resolves the same on every machine and after every reload.
kind = "sides"or"corners_and_sides"writes the rules for a bitmask sheet, the layout Godot and Tiled use.kind = "quarters"draws a cell as four quarters, each chosen by the two cells beside that corner and the one across it. Five tiles cover all 47 neighbourhoods (an RPG-Maker-A2 sheet). A sheet whose five are not consecutive names them:quarters = [fill, horizontal, vertical, outer, inner].
Animated and occluding tiles
[tiles.14]
animation = { frames = [14, 15, 16], fps = 8 }
[tiles.3]
occluder = true
- Animation runs on the frame clock, outside the digest.
- An occluding cell feeds the 2D light map only its exposed edges. Fifty tiles cast one shadow.
Cells and layouts
- Cell
0,0has its top-left corner on the node. The map keeps anorigin; painting reaches in every direction. layout = "isometric"or"hex"on the tileset. Mesh, collider, picking and the painter share one placement function.
The Tiles dock
- Paint, rectangle, fill, line, pick, and a stamp of the selected tile with the ones right of and below it.
- A terrain brush that runs through the engine's own resolver.
- A Set panel that writes solid, one-way or occluder back to the tileset file.
Importing from Tiled and LDtk
balaur import level.tmx --project game
balaur import world.ldtk --project game
Writes the atlas, a tileset per sheet (grid, spacing, margin, per-tile
collision, animations) and a scene for the level: one root named after the
map, one tilemap node per tile layer under it.
An .ldtk project writes a scene per level. Its entities become nodes under
that root, each carrying its fields.
A level too big for a scene keeps its rows in a .cells file that cells
names. tilemap, tileset and tile_collision are in the
reference.