第一次提交作业
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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.health_changed.connect(_on_health_changed)
|
||||
_on_health_changed(player.hp,player.max_hp) # 初始化显示
|
||||
print("信号已连接")
|
||||
|
||||
func _on_health_changed(current: int, max_hp: int):
|
||||
text = "生命: %d/%d" % [current,max_hp]
|
||||
Reference in New Issue
Block a user