|
|
|
@ -154,7 +154,7 @@ impl GridPosition {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn is_colliding_with(&self, other: &Self) -> bool {
|
|
|
|
fn is_colliding_with(&self, other: &Self) -> bool {
|
|
|
|
self.x == other.x && self.y + 1 == other.y
|
|
|
|
self.x == other.x && self.y - 1 == other.y
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn add_offset(&self, RelativePosition { x: x1, y: y1 }: &RelativePosition) -> Self {
|
|
|
|
fn add_offset(&self, RelativePosition { x: x1, y: y1 }: &RelativePosition) -> Self {
|
|
|
|
@ -586,11 +586,7 @@ fn check_collision(
|
|
|
|
// Check if active peice is near other blocks
|
|
|
|
// Check if active peice is near other blocks
|
|
|
|
let hit_block = inactive.iter().any(|b| {
|
|
|
|
let hit_block = inactive.iter().any(|b| {
|
|
|
|
debug!("Checking against: {:?}", b);
|
|
|
|
debug!("Checking against: {:?}", b);
|
|
|
|
if a.is_colliding_with(b) {
|
|
|
|
a.is_colliding_with(b)
|
|
|
|
info!("{:?} is colliding with {:?}", a, b);
|
|
|
|
|
|
|
|
true
|
|
|
|
|
|
|
|
} else { false }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
hit_floor || hit_block
|
|
|
|
hit_floor || hit_block
|
|
|
|
|