Rename argument curr_tick
This commit is contained in:
parent
f8b7ad7631
commit
f3da29f8d6
|
@ -179,14 +179,14 @@ impl PlayerSkin for BasicPlayerSkin {
|
|||
}
|
||||
}
|
||||
|
||||
fn set_state(&mut self, state: PlayerAnimationState, curr_tick: u16) {
|
||||
fn set_state(&mut self, state: PlayerAnimationState, tick: u16) {
|
||||
if self.state != state {
|
||||
self.state = state;
|
||||
|
||||
//self.tick = 0; // this should not happen
|
||||
//self.tick = curr_tick; // this should happen instead, but there's a problem with ticking on 4 that results in an instant 1st frame animation.
|
||||
// this dirty hack should fix that.
|
||||
self.tick = if curr_tick % 5 == 4 {u16::MAX} else {curr_tick};
|
||||
self.tick = if tick % 5 == 4 { u16::MAX } else { tick };
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ pub trait PlayerSkin: PlayerSkinClone {
|
|||
fn tick(&mut self);
|
||||
|
||||
/// Sets the current animation state.
|
||||
fn set_state(&mut self, state: PlayerAnimationState, curr_tick: u16);
|
||||
fn set_state(&mut self, state: PlayerAnimationState, tick: u16);
|
||||
|
||||
/// Returns current animation state.
|
||||
fn get_state(&self) -> PlayerAnimationState;
|
||||
|
|
Loading…
Reference in New Issue