A game created for the Godot Wild Jam #21
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

32 lines
1.4KB

  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. # Called when the node enters the scene tree for the first time.
  9. func _ready():
  10. set_process(true)
  11. _agg_bar.max_value = 100.0
  12. _agg_bar.value = 0.0
  13. _need_bar.max_value = 100.0
  14. _need_bar.value = 0.0
  15. _content_bar.max_value = 100.0
  16. _content_bar.value = 0.0
  17. func _process(delta):
  18. UpdateMoodBars()
  19. func UpdateMoodBars():
  20. var mc = get_node("../Player").get_mood().get_mood_color()
  21. _agg_bar_tween.interpolate_property(_agg_bar, "value", _agg_bar.value, mc.r * 100, 0.1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
  22. _agg_bar_tween.start()
  23. _need_bar_tween.interpolate_property(_need_bar, "value", _need_bar.value, mc.g * 100, 0.1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
  24. _need_bar_tween.start()
  25. _content_bar_tween.interpolate_property(_content_bar, "value", _content_bar.value, mc.b * 100, 0.1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
  26. _content_bar_tween.start()