extends StaticBody2D enum TYPE { bronze, silver, gold } export(TYPE) var type = TYPE.bronze export var value : int = 0 const COIN_DEFAULT_VALUES = [ 1, 2, 5 ] func _ready(): $Sprite.animation = TYPE.keys()[type] if value == 0: value = COIN_DEFAULT_VALUES[type] func _on_Player_entered(body): if visible: GlobalState.coins += value $SoundCollected.play() hide() func _on_SoundCollected_finished(): queue_free() get_parent().remove_child(self)