feat: setup pacman collision, level restart, game over, death sequence, switch to Vec for TileSequence

This commit is contained in:
Ryan Walters
2025-09-08 01:14:32 -05:00
parent 53306de155
commit 823f480916
10 changed files with 531 additions and 310 deletions

View File

@@ -1,5 +1,7 @@
use crate::platform;
use crate::systems::components::{DirectionalAnimation, Frozen, GhostAnimation, GhostState, LastAnimationState, LinearAnimation};
use crate::systems::components::{
DirectionalAnimation, Frozen, GhostAnimation, GhostState, LastAnimationState, LinearAnimation, Looping,
};
use crate::{
map::{
builder::Map,
@@ -194,22 +196,26 @@ pub fn ghost_state_system(
if last_animation_state.0 != current_animation_state {
match current_animation_state {
GhostAnimation::Frightened { flash } => {
// Remove DirectionalAnimation, add LinearAnimation
// Remove DirectionalAnimation, add LinearAnimation with Looping component
commands
.entity(entity)
.remove::<DirectionalAnimation>()
.insert(*animations.frightened(flash));
.insert(animations.frightened(flash).clone())
.insert(Looping);
}
GhostAnimation::Normal => {
// Remove LinearAnimation, add DirectionalAnimation
// Remove LinearAnimation and Looping, add DirectionalAnimation
commands
.entity(entity)
.remove::<LinearAnimation>()
.insert(*animations.get_normal(ghost_type).unwrap());
.remove::<(LinearAnimation, Looping)>()
.insert(animations.get_normal(ghost_type).unwrap().clone());
}
GhostAnimation::Eyes => {
// Remove LinearAnimation, add DirectionalAnimation (eyes animation)
commands.entity(entity).remove::<LinearAnimation>().insert(*animations.eyes());
// Remove LinearAnimation and Looping, add DirectionalAnimation (eyes animation)
commands
.entity(entity)
.remove::<(LinearAnimation, Looping)>()
.insert(animations.eyes().clone());
}
}
last_animation_state.0 = current_animation_state;