feat(stdlib): Tiled P2 — collision normalisation into the Solids feed (#70)
Normalise three collision sources into the byte tilemap esys_move / Grid.* / Path.* read, in the design's priority order (§3.5): - per-tile <objectgroup> hitboxes (Tiled.tile_shapes) — the precise source; - the solid/oneway/trigger bool property convention (Tiled.collision_kind); - the designated collision layer — any non-zero GID solid (Tiled.project), the fallback source, applied automatically on load. Tiled.collide drives collision from a visual layer's per-tile metadata alone (a tile with no collision metadata stays passable). tmap_collision_kind classifies a GID (0 none / 1 solid / 2 one-way / 3 trigger) from its metadata; the projection adds the collision-layer fallback. Proven by library/tiled_p2.ludic (14 assertions): kind classification for each source, the property convention and collision-layer fallback producing an identical Solids feed, a per-tile-<objectgroup> floor blocking an esys_move mover, and A* over a loaded map matching the hand-authored baseline. x test: 93 passed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
bc301c8d17
commit
0cb57774d7
12 changed files with 5425 additions and 4991 deletions
14
docs/language/tiled/tiled-collide.md
Normal file
14
docs/language/tiled/tiled-collide.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
id: tiled-collide
|
||||
name: Tiled.collide
|
||||
category: tiled
|
||||
kind: namespace-method
|
||||
tokens: Tiled.collide
|
||||
sig: Tiled.collide(map, layer: int) -> void
|
||||
tip: Drive collision from per-tile metadata.
|
||||
order: 14
|
||||
ns: Tiled
|
||||
member: collide
|
||||
---
|
||||
|
||||
Projects a layer to the byte tilemap driving collision from per-tile metadata alone — a tile's <code><objectgroup></code> hitbox or its <code>solid</code>/<code>oneway</code>/<code>trigger</code> property — so a tile with no collision metadata stays passable. Use this to drive collision from a visual layer; <a href="tiled-project"><code>Tiled.project</code></a> is the designated-collision-layer form where any non-zero GID is solid.
|
||||
14
docs/language/tiled/tiled-collision_kind.md
Normal file
14
docs/language/tiled/tiled-collision_kind.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
id: tiled-collision_kind
|
||||
name: Tiled.collision_kind
|
||||
category: tiled
|
||||
kind: namespace-method
|
||||
tokens: Tiled.collision_kind
|
||||
sig: Tiled.collision_kind(map, gid: int) -> int
|
||||
tip: Classify a GID's collision from its tile metadata.
|
||||
order: 15
|
||||
ns: Tiled
|
||||
member: collision_kind
|
||||
---
|
||||
|
||||
Returns the collision kind a GID resolves to from its tile metadata, in the design's priority order (per-tile <code><objectgroup></code> hitboxes, then the property convention): <code>0</code> none, <code>1</code> solid, <code>2</code> one-way, <code>3</code> trigger. The collision-layer fallback (any non-zero GID solid) is applied by <a href="tiled-project"><code>Tiled.project</code></a>, not here.
|
||||
14
docs/language/tiled/tiled-tile_shapes.md
Normal file
14
docs/language/tiled/tiled-tile_shapes.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
id: tiled-tile_shapes
|
||||
name: Tiled.tile_shapes
|
||||
category: tiled
|
||||
kind: namespace-method
|
||||
tokens: Tiled.tile_shapes
|
||||
sig: Tiled.tile_shapes(map, gid: int) -> int
|
||||
tip: Whether a GID's tile has a collision shape.
|
||||
order: 16
|
||||
ns: Tiled
|
||||
member: tile_shapes
|
||||
---
|
||||
|
||||
Returns <code>1</code> if the tile a GID resolves to carries a per-tile <code><objectgroup></code> with at least one collision shape (rectangle/ellipse/polygon/point), else <code>0</code> — the precise collision source in the P2 priority order.
|
||||
Loading…
Add table
Add a link
Reference in a new issue