fix: forces immediate animation start in order to avoid 'flashing' or delayed start
This commit is contained in:
@@ -95,7 +95,9 @@ func play(name: String, backwards: bool = false):
|
|||||||
_animation_player.seek(0)
|
_animation_player.seek(0)
|
||||||
elif not _is_animation_player:
|
elif not _is_animation_player:
|
||||||
_animated_sprite.frame = 0
|
_animated_sprite.frame = 0
|
||||||
|
|
||||||
_current_animation = name
|
_current_animation = name
|
||||||
|
|
||||||
if backwards and _is_animation_player:
|
if backwards and _is_animation_player:
|
||||||
_animation_player.play_backwards(name)
|
_animation_player.play_backwards(name)
|
||||||
elif backwards:
|
elif backwards:
|
||||||
@@ -103,6 +105,10 @@ func play(name: String, backwards: bool = false):
|
|||||||
else:
|
else:
|
||||||
_player_node.play(name)
|
_player_node.play(name)
|
||||||
|
|
||||||
|
# Instead of waiting for the next frame, start the animation now.
|
||||||
|
if _is_animation_player:
|
||||||
|
_player_node.advance(0)
|
||||||
|
|
||||||
|
|
||||||
# Play the given animation backwards
|
# Play the given animation backwards
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user