mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-10 08:07:56 -06:00
feat: collision helper, ghost/pacman collision events, collision tests
minor format updates from copilot's commit
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user