luvcraft/intent.lisp
One body's movement will: which directions it is urging, and whether it owes a jump.
The urges are named after the body's own frame -- :FORWARD, :BACKWARD, :LEFT, :RIGHT, and :SPRINT -- rather than after any key or axis, so the same intent serves a walking player and a ridden animal.
Whether intent currently holds urge.
Begin or end intent's urge.
Return -1, 0, or 1 from the two opposed urges intent holds.
Whether intent is urging its body to hurry.
Whether intent is urging nothing at all.
Let go of everything intent was holding.
One body's movement will: which directions it is urging, and whether it owes a jump. The urges are named after the body's own frame -- :FORWARD, :BACKWARD, :LEFT, :RIGHT, and :SPRINT -- rather than after any key or axis, so the same intent serves a walking player and a ridden animal.
(intent urge)(intent positive negative)Subtraction or unary negation.
(intent)Logical conjunction of tests and raw truth values.
Logical negation of one test or raw truth value.
(intent)
What a body is trying to do, as distinct from what someone pressed.
A hash of held keys answered "is W down". An intent answers "is this body trying to go forward", which is a question a keyboard, a gamepad, a script, a recorded demo, and an animal's rider can all answer, and which the physics step can read without knowing that keyboards exist.
Every direction is held separately rather than summed into one number, because pressing both W and S is standing still and then letting go of S must leave the player walking forward again. A single axis cannot remember that; a set of urges can.