pub struct TileAnimState { /* private fields */ }Expand description
Per-frame water/flower background-tile animation.
counter1increments every frame; at 20 the water tile rotates one pixel; at 21 (TileAnimKind::WaterFloweronly) the flower tile advances andcounter1resets. For water-only tilesetscounter1resets right after the water update.counter2increments on each water update (& 7); its bit 2 selects the water rotation direction (right for 4 updates, then left for 4), andcounter2 & 3selects the flower frame (0/1 → 1, 2 → 2, 3 → 3).
Implementations§
Source§impl TileAnimState
impl TileAnimState
pub fn new() -> Self
Sourcepub fn set_tileset(&mut self, kind: TileAnimKind)
pub fn set_tileset(&mut self, kind: TileAnimKind)
Adopt a tileset’s animation kind and reset counter1 (counter2
and the accumulated water shift persist, matching the classic WRAM
behavior on map load).
Sourcepub fn water_shift(&self) -> i8
pub fn water_shift(&self) -> i8
Current horizontal rotation of the water tile in pixels (positive =
right). Sample source column (x - shift) mod 8.
Sourcepub fn flower_frame(&self) -> Option<u8>
pub fn flower_frame(&self) -> Option<u8>
Flower frame (1..=3) to display, or None before the first flower update (the tileset’s base flower tile shows).
Sourcepub fn kind(&self) -> TileAnimKind
pub fn kind(&self) -> TileAnimKind
Animation kind for the current tileset.
Trait Implementations§
Source§impl Clone for TileAnimState
impl Clone for TileAnimState
Source§fn clone(&self) -> TileAnimState
fn clone(&self) -> TileAnimState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for TileAnimState
Source§impl Debug for TileAnimState
impl Debug for TileAnimState
Source§impl Default for TileAnimState
impl Default for TileAnimState
Source§impl<'de> Deserialize<'de> for TileAnimState
impl<'de> Deserialize<'de> for TileAnimState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TileAnimState
impl RefUnwindSafe for TileAnimState
impl Send for TileAnimState
impl Sync for TileAnimState
impl Unpin for TileAnimState
impl UnsafeUnpin for TileAnimState
impl UnwindSafe for TileAnimState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more