type
Vector
Vector
Vector is a 2D vector: two Q16.16 fixed components, x and y, packed into a single value that is copied by value and never heap-allocates. It is the natural type for positions, velocities, directions, and offsets. Build one with Vector.make(x, y) (or Vector.zero()), read the parts with Vector.x / Vector.y, and combine them with the Vector.* math — add, scale, dot, length, normalize, rotate, and the rest. Every operation is deterministic fixed-point, so results are bit-identical on every platform.
Example
program Demo {
handler Step phase Update {
let velocity: Vector = Vector.scale(Vector.from_angle(heading), speed)
position = Vector.add(position, velocity)
}
}