replace existing animation for pushed entity

This commit is contained in:
Corwin 2023-08-29 22:32:03 +01:00
parent f3d0757fa3
commit b78f7345b9
No known key found for this signature in database

View file

@ -51,6 +51,8 @@ fn remove_move_animation_for_entity(
if let Some(existing_animation) = animations.iter().position(|x| { if let Some(existing_animation) = animations.iter().position(|x| {
if let AnimationInstruction::Move(entity, _, _) = x { if let AnimationInstruction::Move(entity, _, _) = x {
*entity == entity_key *entity == entity_key
} else if let AnimationInstruction::FakeOutMove(entity, _, _, _) = x {
*entity == entity_key
} else { } else {
false false
} }
@ -188,6 +190,7 @@ impl EntityMap {
MoveAttemptResolution::AttemptPush => { MoveAttemptResolution::AttemptPush => {
let depth = push_depth - 1; let depth = push_depth - 1;
if depth >= 0 { if depth >= 0 {
remove_move_animation_for_entity(animations, other_entity_key);
let (can_move_result, action_result) = self.attempt_move_in_direction( let (can_move_result, action_result) = self.attempt_move_in_direction(
map, map,
animations, animations,