Mercurial > touhou
comparison src/th06/enemy.rs @ 668:140ee7de6d90
Use the correct half-size of the hitbox.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Mon, 12 Aug 2019 15:09:53 +0200 |
parents | 904849807fd8 |
children | 082c39d7d1c3 |
comparison
equal
deleted
inserted
replaced
667:904849807fd8 | 668:140ee7de6d90 |
---|---|
243 self.z = z; | 243 self.z = z; |
244 } | 244 } |
245 | 245 |
246 /// Sets the hitbox around the enemy. | 246 /// Sets the hitbox around the enemy. |
247 pub fn set_hitbox(&mut self, width: f32, height: f32) { | 247 pub fn set_hitbox(&mut self, width: f32, height: f32) { |
248 self.hitbox_half_size = [width, height]; | 248 self.hitbox_half_size = [width / 2., height / 2.]; |
249 } | 249 } |
250 | 250 |
251 /// Run all interpolators and such, and update internal variables once per | 251 /// Run all interpolators and such, and update internal variables once per |
252 /// frame. | 252 /// frame. |
253 pub fn update(&mut self) { | 253 pub fn update(&mut self) { |