feat(engine): Tiled P5 — image/group layers, iso/hex/staggered coords, Wang (#73)
All checks were successful
bootstrap / cfree-fixpoint (push) Successful in 21s
ci / build-and-test (push) Successful in 1m59s
commit-lint / conventional-commits (push) Successful in 4s
docs / build-and-deploy (push) Successful in 28s

- Image layers: <imagelayer> renders with parallax + optional repeatx/repeaty
  tiling across the view; the image loads relative to the map file. Group layers
  flatten at build (children render in file order); layer offset/opacity/tint are
  queryable (Tiled.layer_kind / layer_offsetx / layer_offsety / layer_opacity /
  layer_tint), a group's tint applying recursively.
- Orientation transforms: Tiled.cell_x / Tiled.cell_y compute a tile cell's
  screen position for orthogonal, isometric ((x-y)*tw/2, (x+y)*th/2), staggered,
  and hexagonal (rows step by (tileh+hexsidelength)/2, alternate rows shoved per
  staggerindex) — the tile draw now places cells through them.
- Wang: exported Wang-set GIDs are ordinary GIDs and resolve through the standard
  GID resolver; the terrain-corner authoring concept is editor-side (design cut).

Proven by library/tiled_p5.ludic (14 assertions) over the real
isometric_grass_and_water.tmx (iso + Wang) and hexagonal-mini.tmx, plus a
hand-authored image+group fixture. x test: 96 passed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-01 15:14:36 +03:00
parent b8c71d2a8e
commit 78a5719fae
15 changed files with 5829 additions and 5007 deletions

View file

@ -0,0 +1,14 @@
---
id: tiled-cell_x
name: Tiled.cell_x
category: tiled
kind: namespace-method
tokens: Tiled.cell_x
sig: Tiled.cell_x(map, x: int, y: int) -> int
tip: The screen x of a tile cell for the map orientation.
order: 30
ns: Tiled
member: cell_x
---
Returns the screen x (before the camera) of tile cell <code>(x,y)</code> under the map's orientation: orthogonal <code>x·tilew</code>, isometric <code>(x−y)·tilew/2</code>, staggered/hexagonal <code>x·tilew</code> with alternate rows shoved half a tile per <code>staggerindex</code>.

View file

@ -0,0 +1,14 @@
---
id: tiled-cell_y
name: Tiled.cell_y
category: tiled
kind: namespace-method
tokens: Tiled.cell_y
sig: Tiled.cell_y(map, x: int, y: int) -> int
tip: The screen y of a tile cell for the map orientation.
order: 31
ns: Tiled
member: cell_y
---
Returns the screen y of tile cell <code>(x,y)</code>: orthogonal <code>y·tileh</code>, isometric <code>(x+y)·tileh/2</code>, staggered <code>y·tileh/2</code>, hexagonal rows stepping by <code>(tileh+hexsidelength)/2</code>.

View file

@ -0,0 +1,14 @@
---
id: tiled-layer_kind
name: Tiled.layer_kind
category: tiled
kind: namespace-method
tokens: Tiled.layer_kind
sig: Tiled.layer_kind(map, layer: int) -> int
tip: A layer's kind.
order: 32
ns: Tiled
member: layer_kind
---
Returns a layer's kind: <code>0</code> tile layer, <code>1</code> object layer, <code>2</code> image layer, <code>3</code> group (its children are flattened in after it), or <code>-1</code> out of range.

View file

@ -0,0 +1,14 @@
---
id: tiled-layer_offsetx
name: Tiled.layer_offsetx
category: tiled
kind: namespace-method
tokens: Tiled.layer_offsetx
sig: Tiled.layer_offsetx(map, layer: int) -> int
tip: A layer's horizontal offset.
order: 35
ns: Tiled
member: layer_offsetx
---
Returns a layer's horizontal draw offset in pixels (0 when unset).

View file

@ -0,0 +1,14 @@
---
id: tiled-layer_offsety
name: Tiled.layer_offsety
category: tiled
kind: namespace-method
tokens: Tiled.layer_offsety
sig: Tiled.layer_offsety(map, layer: int) -> int
tip: A layer's vertical offset.
order: 36
ns: Tiled
member: layer_offsety
---
Returns a layer's vertical draw offset in pixels (0 when unset).

View file

@ -0,0 +1,14 @@
---
id: tiled-layer_opacity
name: Tiled.layer_opacity
category: tiled
kind: namespace-method
tokens: Tiled.layer_opacity
sig: Tiled.layer_opacity(map, layer: int) -> string
tip: A layer's opacity.
order: 33
ns: Tiled
member: layer_opacity
---
Returns a layer's opacity as a string in [0,1] (<code>"1"</code> when unset).

View file

@ -0,0 +1,14 @@
---
id: tiled-layer_tint
name: Tiled.layer_tint
category: tiled
kind: namespace-method
tokens: Tiled.layer_tint
sig: Tiled.layer_tint(map, layer: int) -> string
tip: A layer's tint colour.
order: 34
ns: Tiled
member: layer_tint
---
Returns a layer's <code>tintcolor</code> (e.g. <code>#ff0000</code>), or <code>""</code> if none — a group's tint applies recursively to its children.