選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

23 行
578 B

  1. extends Control
  2. export var healthBar_path : NodePath
  3. onready var healthBar = get_node(healthBar_path)
  4. export var goldText_path : NodePath
  5. onready var goldText = get_node(goldText_path)
  6. # called when we take damage
  7. func update_health_bar (curHp, maxHp):
  8. fetch_components()
  9. healthBar.value = (100 / maxHp) * curHp
  10. # called when our gold changes
  11. func update_gold_text (gold):
  12. fetch_components()
  13. goldText.text = "Gold: " + str(gold)
  14. func fetch_components():
  15. if healthBar == null:
  16. healthBar = get_node("HealthBar")
  17. if goldText == null:
  18. goldText = get_node("GoldText")