From 284cb0d53969532f6e9338f8114f75cb927b2f42 Mon Sep 17 00:00:00 2001 From: Julian Murgia Date: Wed, 23 Mar 2022 13:56:18 +0100 Subject: [PATCH] Fix: Mirroed ESCItem's talk animation was conflicting with mirrored idle Also remove multiple calls to get_animation_player() Fixes https://github.com/godot-escoria/escoria-issues/issues/201 --- .../game/core-scripts/esc_item.gd | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/addons/escoria-core/game/core-scripts/esc_item.gd b/addons/escoria-core/game/core-scripts/esc_item.gd index aeb5578b..6286bef9 100644 --- a/addons/escoria-core/game/core-scripts/esc_item.gd +++ b/addons/escoria-core/game/core-scripts/esc_item.gd @@ -500,13 +500,16 @@ func start_talking(): and get_animation_player() \ and _movable.last_dir >= 0 \ and _movable.last_dir < animations.speaks.size(): - if get_animation_player().is_playing(): - get_animation_player().stop() + var animation_player = get_animation_player() + + if animation_player.is_playing(): + animation_player.stop() - if animations.speaks[_movable.last_dir].mirrored: + if animations.speaks[_movable.last_dir].mirrored \ + and not _movable.is_mirrored: _sprite_node.scale.x *= -1 - get_animation_player().play( + animation_player.play( animations.speaks[_movable.last_dir].animation ) @@ -518,13 +521,16 @@ func stop_talking(): and get_animation_player() \ and _movable.last_dir >= 0 \ and _movable.last_dir < animations.speaks.size(): - if get_animation_player().is_playing(): - get_animation_player().stop() + var animation_player = get_animation_player() + + if animation_player.is_playing(): + animation_player.stop() - if animations.speaks[_movable.last_dir].mirrored: + if animations.speaks[_movable.last_dir].mirrored \ + and not _movable.is_mirrored: _sprite_node.scale.x *= -1 - get_animation_player().play( + animation_player.play( animations.idles[_movable.last_dir].animation )