Expand description
Render- and map-model-agnostic overworld walking actor.
The GB-shaped overworld (super::player_movement over MapTrait+TilesetTrait
with u8 coords and 4×4 blocks) doesn’t fit full-color games whose maps are
source-direct image grids with i32 coords. This is the generic actor every
game can drive: it owns tile position, smooth pixel interpolation, facing, and the
walk-cycle animation state, asking the map only OverworldCollision::is_blocked.
It returns indices, never pixels — the consumer’s renderer is free (wuxia/minimon
blit a full-color crate-external WalkSprite; pokered keeps its GB-OAM painter).
NPC occupancy and warps stay caller-side: fold NPCs into is_blocked, and check
warps against the tile OverworldActor::update reports a step completed on.
Structs§
- Overworld
Actor - A walking overworld actor (player or NPC): tile target + interpolated pixel
position + facing + walk animation. Tile size is configurable (
tile).
Enums§
- Locomotion
- Locomotion state the renderer maps to sprite columns: standing, walking, or
running.
Runonly looks distinct when the sheet has dedicated run frames (the canonical overworld layout puts them at cols 3/4 — seeframe_col); otherwise the consumer reuses the walk frames at the faster running cadence.
Traits§
- Overworld
Collision - The minimum a map must answer for the actor to move: is walking onto
(x, y)blocked? Out-of-bounds should returntrue(enclosed world). Callers fold in dynamic collision (NPC tiles, locked doors) by composing it into this impl.
Functions§
- frame_
col - Resolve the sprite-sheet column for a locomotion state + step phase, given the
sheet’s column count. Canonical overworld layout: col 0 = stand, cols 1/2 = walk,
cols 3/4 = run. Sheets without run frames (
cols < 5) reuse the walk columns while running (the faster cadence still reads as a run).phaseis0/1fromOverworldActor::step_phase.