Mercurial > touhou
diff src/th06/enemy.rs @ 667:904849807fd8
Implement update_mode 1 on enemy.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Mon, 12 Aug 2019 15:09:34 +0200 |
parents | 838d9402b12f |
children | 140ee7de6d90 |
line wrap: on
line diff
--- 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;