Collision on Y axis seems to work

This commit is contained in:
2018-10-06 12:10:18 +02:00
parent 89295b9283
commit cd1befafa5
4 changed files with 75 additions and 22 deletions
+5 -4
View File
@@ -8,6 +8,7 @@ use sfml::window::Event;
use sfml::window::Key;
use sfml::graphics::{
IntRect,
FloatRect,
View,
};
@@ -146,6 +147,10 @@ impl Character {
View::new(self.position, Vector2::new(24.0 * 16.0, 24.0 * 9.0))
}
/// Returns the collision bounding box of the character.
pub fn bbox(&self) -> FloatRect {
FloatRect::new(self.position.x, self.position.y, 32.0, 32.0)
}
}
impl Updatable for Character {
@@ -229,8 +234,4 @@ impl Drawable for Character {
fn position(&self) -> Vector2<f32> {
self.position
}
fn origin(&self) -> Vector2<f32> {
Vector2::new(16.0, 16.0)
}
}