A game created for the Godot Wild Jam #21
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

42 行
1.8KB

  1. extends CanvasLayer
  2. onready var _agg_bar = get_node("PlayerUI/MoodBars/Aggression/Bar/Progress")
  3. onready var _agg_bar_tween = get_node("PlayerUI/MoodBars/Aggression/Bar/Progress/Tween")
  4. onready var _need_bar = get_node("PlayerUI/MoodBars/Neediness/Bar/Progress")
  5. onready var _need_bar_tween = get_node("PlayerUI/MoodBars/Neediness/Bar/Progress/Tween")
  6. onready var _content_bar = get_node("PlayerUI/MoodBars/Contentment/Bar/Progress")
  7. onready var _content_bar_tween = get_node("PlayerUI/MoodBars/Contentment/Bar/Progress/Tween")
  8. onready var _nrg_bar = get_node("PlayerUI/NRG/Bar/Progress")
  9. onready var _nrg_bar_tween = get_node("PlayerUI/NRG/Bar/Progress/Tween")
  10. # Called when the node enters the scene tree for the first time.
  11. func _ready():
  12. set_process(true)
  13. _agg_bar.max_value = 100.0
  14. _agg_bar.value = 0.0
  15. _need_bar.max_value = 100.0
  16. _need_bar.value = 0.0
  17. _content_bar.max_value = 100.0
  18. _content_bar.value = 0.0
  19. _nrg_bar.max_value = get_node("../Player").max_energy
  20. _nrg_bar.value = get_node("../Player").get_current_energy()
  21. func _process(delta):
  22. UpdateMoodBars()
  23. func UpdateMoodBars():
  24. var p = get_node("../Player")
  25. var mc = p.get_mood().get_mood_color()
  26. _agg_bar_tween.interpolate_property(_agg_bar, "value", _agg_bar.value, mc.r * 100, 0.1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
  27. _agg_bar_tween.start()
  28. _need_bar_tween.interpolate_property(_need_bar, "value", _need_bar.value, mc.g * 100, 0.1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
  29. _need_bar_tween.start()
  30. _content_bar_tween.interpolate_property(_content_bar, "value", _content_bar.value, mc.b * 100, 0.1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
  31. _content_bar_tween.start()
  32. _nrg_bar_tween.interpolate_property(_nrg_bar, "value", _nrg_bar.value, p.get_current_energy(), 0.1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
  33. _nrg_bar_tween.start()