feat: fruit spawning mechanism, sprites, pellet counting, fruit trigger observer

This commit is contained in:
Ryan Walters
2025-09-09 11:25:30 -05:00
parent b4990af109
commit 5d56b31353
8 changed files with 203 additions and 10 deletions

View File

@@ -9,6 +9,7 @@ pub enum EntityType {
Ghost,
Pellet,
PowerPellet,
Fruit(crate::texture::sprites::FruitSprite),
}
impl EntityType {
@@ -24,12 +25,13 @@ impl EntityType {
match self {
EntityType::Pellet => Some(10),
EntityType::PowerPellet => Some(50),
EntityType::Fruit(fruit_type) => Some(fruit_type.score_value()),
_ => None,
}
}
pub fn is_collectible(&self) -> bool {
matches!(self, EntityType::Pellet | EntityType::PowerPellet)
matches!(self, EntityType::Pellet | EntityType::PowerPellet | EntityType::Fruit(_))
}
}