22 lines
480 B
GDScript
22 lines
480 B
GDScript
extends Label
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
# Replace with function body.
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
pass
|
|
|
|
|
|
func _ready():
|
|
var player = %Player
|
|
if player:
|
|
player.coin_changed.connect(_on_coin_changed)
|
|
_on_coin_changed(player.coins) # 初始化显示
|
|
print("信号已连接")
|
|
|
|
func _on_coin_changed(total: int):
|
|
text = "金币: %d/12" % total
|