Signal Priority Question

Godot Version



Hey guys, I am new to godot and gamedev in general, can someone tell me what will happen if within the same script, 2 signals fire at the same time, both affecting a sprite’s animation. Which one will win over the other?

My Scene: a root node2d, “Crow”, an animated Sprite 2d “CrowSprite”, an Area2d
animated sprite has 2 default animations that i am playing randomly every time one of them ends (i set them to non loop) using the animation finished signal.

while the script is looking out for the sprite’s animations to finish, it is also looking out for a player to enter the area2d for it to play the “fly” animation, this is through the body entered signal.

if a body enters at the same time the animation finishes, which will play? the default animations, or the fly animation?

here is my code, thank you for your time.

extends Node2D

func _ready():
var time = randi() % 2 #random time to start the animation
await(get_tree().create_timer(time).timeout) #wait for the random time

func _process(_delta):

func _on_area_2d_body_entered(body):
if == “Player”:

func fly_away():
var tween:= create_tween()
tween.tween_property(self, “position”, Vector2(self.position.x + 500, self.position.y - 100), 5)

func despawn():

func _on_crow_sprite_animation_finished():
if ($CrowSprite.animation == “default” or $CrowSprite.animation == “default2”) and $CrowSprite.animation != “fly”:
var random_animation = randi() % 2
if random_animation == 0: