feat: collision helper, ghost/pacman collision events, collision tests

minor format updates from copilot's commit
This commit is contained in:
Ryan Walters
2025-08-27 22:26:49 -05:00
parent 67a5c4a1ed
commit 9624bcf359
6 changed files with 206 additions and 40 deletions

View File

@@ -114,6 +114,14 @@ pub struct Collider {
pub size: f32,
}
impl Collider {
/// Checks if this collider collides with another collider at the given distance.
pub fn collides_with(&self, other_size: f32, distance: f32) -> bool {
let collision_distance = (self.size + other_size) / 2.0;
distance < collision_distance
}
}
/// Marker components for collision filtering optimization
#[derive(Component)]
pub struct PacmanCollider;