diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2022-02-28 16:00:45 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2022-02-28 16:00:45 +0800 |
commit | 3a439a9c0378d0c6f7d8ce67084863abbe4e87bc (patch) | |
tree | ac28bdccd7e16aae8fe99a408507bbb41158f1a9 /scene/2d | |
parent | 353be6261f1db9c34d322faadfa2807998b3a5d8 (diff) |
Fix AnimatedSprite infinite loop
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/animated_sprite_2d.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index 2d05d46342..257e334873 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -158,14 +158,14 @@ void AnimatedSprite2D::_notification(int p_what) { return; } - double speed = frames->get_animation_speed(animation) * speed_scale; - if (speed == 0) { - return; //do nothing - } - double remaining = get_process_delta_time(); while (remaining) { + double speed = frames->get_animation_speed(animation) * speed_scale; + if (speed == 0) { + return; // Do nothing. + } + if (timeout <= 0) { timeout = _get_frame_duration(); |