Merge pull request #31943 from codecustard/Fixes_invalid_frames_on_reverse_anim

Fixes Reverse Animation Starting on First Frame
This commit is contained in:
Rémi Verschelde 2019-10-27 09:55:44 +01:00 committed by GitHub
commit 2416fbb4e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -604,10 +604,14 @@ bool AnimatedSprite::_is_playing() const {
void AnimatedSprite::play(const StringName &p_animation, const bool p_backwards) {
if (p_animation)
set_animation(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);
}
_set_playing(true);
}