Collision on Y axis seems to work
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user