Added hitboxes and something for the bugs to run into
[bug-basher.git] / src / hitbox.rs
1 use geometry::*;
2
3 pub trait CircleHitbox {
4     fn pos(&self) -> Vec2d;
5     fn radius(&self) -> f64;
6     
7     fn touches_point(&self, point: Vec2d) -> bool {
8         self.pos().distance(point) <= self.radius()
9     }
10
11     fn touches_circle(&self, other: &CircleHitbox) -> bool {
12         self.pos().distance(other.pos()) <= self.radius() + other.radius()
13     }
14 }