Skip to main content

Module walk

Module walk 

Source
Expand description

How units move on a grid map (game ticket 0440): a unit that can still act steps on the spot, and a moving unit glides from tile to tile along its path, its legs going, turned the way it walks. Every timing is here.

All of it is a look (game ADR-0038): the rules, the camera and the sounds go by the tile a walk is on, which changes at each tile’s edge. How fast a walk goes is the look’s too: each skin’s setting (GridSkin::walk).

Structs§

Gait
How a unit between two tiles of its walk looks.

Enums§

Facing
Which way a unit is turned. A look only: never a rule.

Constants§

IDLE_FRAMES
The frames of a unit stepping on the spot, one per IDLE_STEP_MS: standing, one foot, standing, the other foot. It starts on the standing frame.
IDLE_STEP_MS
How long each frame of a unit stepping on the spot shows, in milliseconds. Tunable.
STANDING_FRAME
The walking frame of a unit standing with its feet together.
WALK_FRAMES
The frames of a walking unit, one per WALK_FRAME_S: one foot, standing, the other foot, standing. It starts with a foot forward.
WALK_FRAME_S
How long each frame of a walking unit shows, in seconds. Tunable.

Functions§

facing
The way a step from from to to goes: left or right if it goes across at all, else up or down.
gait
The look of a unit that has walked tiles tiles along path (its start first) at pace tiles per second, beside the tile steps puts it on; None once it has arrived (or has nowhere to go): it then stands, facing the camera.
idle_frame
The frame of a unit stepping on the spot at clock_ms on the screen’s animation clock. Every such unit steps together.
steps
How many steps of a path of len tiles a walk has taken once it has gone tiles tiles: a step is taken as its tile is reached (at most all of them; none for a negative or NaN distance).