pub struct BoulderDustState { /* private fields */ }Expand description
The 2×2 smoke-puff block kicked up when a pushed boulder slides one
tile. The block is written once, anchored to the player’s map tile at
push time (the animation outlives the push lockout, so the anchor must
not track the player afterward), then runs BOULDER_DUST_STEPS steps
of BOULDER_DUST_STEP_FRAMES frames each. Every step the block drifts
1px against the boulder’s slide direction and the sprite palette
toggles, flashing two gray shades.
Implementations§
Source§impl BoulderDustState
impl BoulderDustState
Sourcepub const fn new(facing: Direction, anchor_x: u16, anchor_y: u16) -> Self
pub const fn new(facing: Direction, anchor_x: u16, anchor_y: u16) -> Self
Start the dust for a push in facing direction, anchored to the
player’s map tile at push time.
Sourcepub fn anchor(&self) -> (u16, u16)
pub fn anchor(&self) -> (u16, u16)
The player’s map tile at push time — the dust’s world anchor.
Sourcepub fn base_offset(&self) -> (i32, i32)
pub fn base_offset(&self) -> (i32, i32)
Base pixel offset of the dust block’s top-left corner from the player sprite’s top-left (the puff appears at the boulder’s base, “2 blocks away from the player”).
Sourcepub fn drift_px(&self) -> (i32, i32)
pub fn drift_px(&self) -> (i32, i32)
Per-step pixel drift of the dust block — opposite to the boulder’s slide direction. The puff lingers as the boulder slides away from it.
Sourcepub fn tile_drifts(&self) -> [(i32, i32); 4]
pub fn tile_drifts(&self) -> [(i32, i32); 4]
Per-step pixel delta of each of the block’s four 8×8 tiles (upper-left, upper-right, lower-left, lower-right). Vertical pushes move the whole block; horizontal pushes move only the upper-right, lower-left and lower-right tiles — the upper-left tile stays in place.
Sourcepub fn palette_flipped(&self) -> bool
pub fn palette_flipped(&self) -> bool
True on odd steps: the palette toggles once per step, flashing the two gray shades of the smoke sprite.
Trait Implementations§
Source§impl Clone for BoulderDustState
impl Clone for BoulderDustState
Source§fn clone(&self) -> BoulderDustState
fn clone(&self) -> BoulderDustState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more