coin.gd 282 B

12345678910
  1. class_name Coin extends Area2D
  2. ## Collectible that disappears when the player touches it.
  3. @onready var animation_player := $AnimationPlayer as AnimationPlayer
  4. func _on_body_entered(body: Node2D) -> void:
  5. animation_player.play(&"picked")
  6. (body as Player).coin_collected.emit()