Skip to content

Search

رجوع
· وقت القراءة: 2 د

Tile maps

Tile collision as one voxel shape, autotiling from an ordered rule table, animated and light-blocking tiles, isometric and hex, and Tiled import.

Tile maps get collision as one voxel shape, autotiling from an ordered rule table, animated and light-blocking tiles, isometric and hex layouts, a Tiles dock, and Tiled import.

The Tiles dock painting a ground layer, tile_collision on the map in the inspector

  • The tileset marks solid tiles, and tile_collision on the map builds one parry voxel shape from them. Slopes are polygons in tile pixels, one_way = true makes a platform, and after set_cell the collider is rebuilt once on the next fixed step.
  • Autotiling is one table of [[rules]], first match wins. transforms covers eight orientations per rule, so a 47-tile blob is a dozen rules. outside says whether the map edge counts as the same terrain, and variation is hashed from the cell's coordinate. mode = "sides" or "corners_and_sides" writes the rules from a bitmask sheet.
  • animation = { frames, fps } runs on the frame clock, outside the digest. occluder = true feeds the 2D light map only the exposed edges, so fifty tiles cast one shadow.
  • Cell 0,0 has its top-left corner on the node and the map keeps an origin.
  • The Tiles dock paints, fills, draws rectangles and lines, and picks. It has a terrain brush through the engine's own resolver, and a Set panel that writes solid, one-way or occluder back to the tileset file.
  • layout = "isometric" or "hex" goes on the tileset. Mesh, collider, picking and painter share one placement function.
  • balaur import level.tmx --project game writes the atlas, a tileset per sheet (grid, spacing, margin, per-tile collision, animations) and a scene with one tilemap node per layer.
[tiles.0]
collision = "full"

[tiles.7]
collision = [[[0, 16], [16, 16], [16, 8]]]   # a slope, in tile pixels
one_way = true

[tiles.14]
animation = { frames = [14, 15, 16], fps = 8 }

[tiles.3]
occluder = true

[[rules]]
terrain = "grass"
pattern = ["?#?",     # ? any   # this terrain   . anything else
           "?#.",
           "?##"]
tile = 12
transforms = ["rotate", "mirror"]
outside = "same"

Quarter-tile sheets, LDtk import, chunked cell files and the multi-tile stamp came with it. Roadmap, plan. tilemap and tile_collision are in the components reference.