diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2018-09-12 21:39:34 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2018-09-12 21:39:34 +0200 |
commit | 38caea2a14bb3c205e4c42daa9f11f0f60550360 (patch) | |
tree | c73226397a8334418280ce09fa7caf96c4ae6db8 /src/entities | |
parent | 57f412d73a151f7a4fa35feaf249808dcbe5b5dc (diff) |
Changed hitboxed from an 'is a hitbox' to a 'has a hitbox'
Diffstat (limited to 'src/entities')
-rw-r--r-- | src/entities/bug.rs | 11 | ||||
-rw-r--r-- | src/entities/home.rs | 11 |
2 files changed, 8 insertions, 14 deletions
diff --git a/src/entities/bug.rs b/src/entities/bug.rs index b5e31c7..b299305 100644 --- a/src/entities/bug.rs +++ b/src/entities/bug.rs @@ -26,13 +26,10 @@ impl Bug { pub fn advance(&mut self, seconds: f64) { self.pos = self.pos + self.velocity * seconds; } -} -impl CircleHitbox for Bug { - fn pos(&self) -> Vec2d { - self.pos - } - fn radius(&self) -> f64 { - 75. + pub fn hitbox(&self) -> Hitbox { + Hitbox::Circle(CircleHitbox{ + pos: self.pos, radius: 75. + }) } } diff --git a/src/entities/home.rs b/src/entities/home.rs index 5666a75..5e2ea12 100644 --- a/src/entities/home.rs +++ b/src/entities/home.rs @@ -35,13 +35,10 @@ impl Home { SpriteId::Sleepypug2 } ; } -} -impl CircleHitbox for Home { - fn pos(&self) -> Vec2d { - self.pos - } - fn radius(&self) -> f64 { - 100. + pub fn hitbox(&self) -> Hitbox { + Hitbox::Circle(CircleHitbox{ + pos: self.pos, radius: 100. + }) } } |