#Awaiting TweenProperty to finish causes area_entered(area: Area2D) signal to fire twice

2 messages · Page 1 of 1 (latest)

limber jungle
#

I need some help understanding why waiting for the tween to finish causes the player to receive an area_entered signal twice from another area.

Commenting out await tween.finished will only increment score once, but then the tween doesn't play.

Coin scene function that fires:

func pickup():
    # Stops coin from monitoring areas entering it
    monitoring = false
    tween.play()
    await tween.finished
    queue_free()```

Player scene function that fires when area_entered signal is emitted:

func _on_area_entered(area):
if area.is_in_group("coins"):
area.pickup()
emit_signal("pickup")


Main scene that increments score:

func _on_player_pickup():
score += 1
$Hud.update_score(score)
$CoinSound.play()

limber jungle
#

Interestingly, removing the monitoring = false line fixes the issue...