init: initial commit
This commit is contained in:
15
scripts/coin.gd
Normal file
15
scripts/coin.gd
Normal file
@@ -0,0 +1,15 @@
|
||||
extends Area2D
|
||||
|
||||
@export var coin_id: String
|
||||
|
||||
func _ready():
|
||||
if coin_id == "":
|
||||
coin_id = name
|
||||
|
||||
if GameManager.collected_coins.has(coin_id):
|
||||
queue_free()
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
GameManager.add_score()
|
||||
GameManager.collected_coins[coin_id] = true
|
||||
queue_free()
|
||||
Reference in New Issue
Block a user