#79 — Input.axis_i(neg,pos) -> int returns a -1/0/1 movement intent from the multi-key device set, so WASD-to-movement needs no bool->int glue and feeds an int mover directly (dx = Input.axis_i('a','d')). #84 — a Bounds config entity (rect + policy, from ludic.core) drives the engine-owned world-bounds system (LateUpdate): clamp / wrap / bounce (clamp + flip Body velocity) / kill (despawn a body fully outside). Reads the Collider size so the box stays inside; off by default, spliced only when Bounds is declared (byte-identical otherwise). Adds World.despawn(e) — the by-id reflective despawn (runs @OnDespawn + frees) via a new world_despawn intrinsic whose @fn_world_despawn helper is emitted in emit_program's tail once a use is seen (the g_uses_* prelude pattern), used by the kill policy and callable from any system. Examples input_movement + world_bounds. Full suite 112/0, goldens byte-identical, fixpoint holds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
0497029dae
commit
ad3be0c53c
17 changed files with 30435 additions and 29731 deletions
25
examples/library/input_movement.ludic
Normal file
25
examples/library/input_movement.ludic
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# input_movement.ludic — Input.axis_i (#79): turn WASD into a -1/0/1 movement
|
||||
# intent as a plain int, with no bool->int glue (`ki(key_down('d')) - ...`). It
|
||||
# reads the multi-key device set and feeds an int mover directly. Driven headless
|
||||
# by injection, the same way the #50 device tests are.
|
||||
#
|
||||
# Deterministic; a full run prints: 1 0 -1 -1 0
|
||||
program InputMovement {
|
||||
entry {
|
||||
Input.press('d') # hold right
|
||||
Input.poll()
|
||||
print(Input.axis_i('a', 'd')) # 1 — dx = right
|
||||
print(Input.axis_i('w', 's')) # 0 — dy = none
|
||||
|
||||
Input.release('d')
|
||||
Input.press('a') # hold left
|
||||
Input.press('w') # and up
|
||||
Input.poll()
|
||||
print(Input.axis_i('a', 'd')) # -1 — dx = left
|
||||
print(Input.axis_i('w', 's')) # -1 — dy = up
|
||||
|
||||
Input.press('d') # now both left AND right held
|
||||
Input.poll()
|
||||
print(Input.axis_i('a', 'd')) # 0 — opposing keys cancel
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue