# HG changeset patch # User Emmanuel Gil Peyrot # Date 1565615374 -7200 # Node ID 904849807fd888a94f6f9377845d6fe5ba50b2c9 # Parent 838d9402b12f56872665cf845217d3ad16633989 Implement update_mode 1 on enemy. diff --git a/src/th06/enemy.rs b/src/th06/enemy.rs --- a/src/th06/enemy.rs +++ b/src/th06/enemy.rs @@ -254,7 +254,17 @@ impl Enemy { let Position { mut x, mut y } = self.pos; let speed = if self.update_mode == 1 { - 0. + let mut speed = 0.; + if let Some(interpolator) = &self.interpolator { + let values = interpolator.values(self.frame as u16); + x = values[0]; + y = values[1]; + } + if let Some(interpolator) = &self.speed_interpolator { + let values = interpolator.values(self.frame as u16); + speed = values[0]; + } + speed } else { let speed = self.speed; self.speed += self.acceleration;