pub struct TeleportSpinState { /* private fields */ }Expand description
State of the teleport / escape-item spin-out animation.
Frame-driven: constructed when the leave-warp is triggered, ticked once
per frame by the update loop; the warp fade-out starts when
Self::is_done becomes true.
spin_order is the facing cycle the animation rotates through, starting
from the player’s current facing (the classic order is
[Down, Left, Up, Right]).
Implementations§
Source§impl TeleportSpinState
impl TeleportSpinState
pub fn new(current_facing: Direction, spin_order: [Direction; 4]) -> Self
Sourcepub fn tick(&mut self) -> Option<TeleportSpinSfx>
pub fn tick(&mut self) -> Option<TeleportSpinSfx>
Advance one frame. Returns the sound cue to play this frame, if any
(TeleportSpinSfx::SpinLoop on spins whose delay is a multiple of
4, TeleportSpinSfx::Rise at the start of the spin-up).
pub fn is_done(&self) -> bool
pub fn phase(&self) -> TeleportSpinPhase
Sourcepub fn facing(&self) -> Direction
pub fn facing(&self) -> Direction
Current player facing (the spin rotating through the facing cycle).
Sourcepub fn player_y_offset(&self) -> i32
pub fn player_y_offset(&self) -> i32
Vertical pixel offset of the player sprite (≤ 0; rises off screen during the spin-up phase).
Sourcepub fn player_visible(&self) -> bool
pub fn player_visible(&self) -> bool
Whether the player sprite is still on screen (by the last step the sprite has risen fully above the visible area).
Trait Implementations§
Source§impl Clone for TeleportSpinState
impl Clone for TeleportSpinState
Source§fn clone(&self) -> TeleportSpinState
fn clone(&self) -> TeleportSpinState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more