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
|
|
@ -622,8 +622,11 @@ function emit_ns_call(ns: pointer, meth: pointer, e: Node) -> Val {
|
|||
if (meth == "layer_name") { bare = "tmap_layer_name"; push(labels, "map"); push(labels, "index") }
|
||||
if (meth == "draw") { bare = "tmap_draw"; push(labels, "map"); push(labels, "camx"); push(labels, "camy") }
|
||||
if (meth == "project") { bare = "tmap_project"; push(labels, "map"); push(labels, "layer") }
|
||||
if (meth == "collide") { bare = "tmap_collide"; push(labels, "map"); push(labels, "layer") }
|
||||
if (meth == "collision_kind") { bare = "tmap_collision_kind"; push(labels, "map"); push(labels, "gid") }
|
||||
if (meth == "tree") { bare = "tmap_tree"; push(labels, "map") }
|
||||
if (meth == "tile_prop") { bare = "tmap_tile_prop"; push(labels, "map"); push(labels, "gid"); push(labels, "name") }
|
||||
if (meth == "tile_shapes") { bare = "tmap_tile_has_shapes"; push(labels, "map"); push(labels, "gid") }
|
||||
}
|
||||
# #62: a package-provided namespace (declared with @Namespace(Foo)) that none
|
||||
# of the hardcoded core blocks matched — alias Foo.method to the bare function
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue