summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-10-27 09:55:44 +0100
committerGitHub <noreply@github.com>2019-10-27 09:55:44 +0100
commit2416fbb4e2c8b80638e84aadba4245e2e5f640e9 (patch)
tree9b2af5d983f05f3985c54ffd734ba55aa9cf26ca /scene/2d
parent4f0c05402f94e6055463c86bcdbb06b2b72b3d7d (diff)
parent94a00cd9c7753f9f601e2b61cdba3a909746abf7 (diff)
Merge pull request #31943 from codecustard/Fixes_invalid_frames_on_reverse_anim
Fixes Reverse Animation Starting on First Frame
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/animated_sprite.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/scene/2d/animated_sprite.cpp b/scene/2d/animated_sprite.cpp
index 20ec06f033..9d02408641 100644
--- a/scene/2d/animated_sprite.cpp
+++ b/scene/2d/animated_sprite.cpp
@@ -604,10 +604,14 @@ bool AnimatedSprite::_is_playing() const {
void AnimatedSprite::play(const StringName &p_animation, const bool p_backwards) {
- if (p_animation)
+ backwards = p_backwards;
+
+ if (p_animation) {
set_animation(p_animation);
+ if (backwards && get_frame() == 0)
+ set_frame(frames->get_frame_count(p_animation) - 1);
+ }
- backwards = p_backwards;
_set_playing(true);
}