GodotGame/scripts/coin.gd

10 lines
188 B
GDScript

class_name Coin extends Area2D
signal coinCollected
func _on_body_entered(body):
if body.is_in_group("player"):
print("somebody entered a coin")
coinCollected.emit()
queue_free()