mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-11 02:08:01 -06:00
feat: entity trait, direction enum (util)
This commit is contained in:
6
src/direction.rs
Normal file
6
src/direction.rs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
pub enum Direction {
|
||||||
|
Up,
|
||||||
|
Down,
|
||||||
|
Left,
|
||||||
|
Right,
|
||||||
|
}
|
||||||
8
src/entity.rs
Normal file
8
src/entity.rs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
pub trait Entity {
|
||||||
|
// Returns true if the entity is colliding with the other entity
|
||||||
|
fn is_colliding(&self, other: &dyn Entity) -> bool;
|
||||||
|
// Returns the absolute position of the entity
|
||||||
|
fn position(&self) -> (i32, i32);
|
||||||
|
// Returns the cell position of the entity (XY position within the grid)
|
||||||
|
fn cell_position(&self) -> (u32, u32);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user