Files
2026-10-07 19:35:15 +08:00

20 lines
505 B
GDScript

extends Area2D
signal win
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
body_entered.connect(_on_body_entered) # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
signal not_enough_coins
func _on_body_entered(body: Node2D) -> void:
if body.has_method("take_damage"):
if body.coins >= 12:
win.emit()
print("胜利")
else:
not_enough_coins.emit()