This repository has been archived on 2025-09-12. You can view files and clone it, but cannot push or open issues or pull requests.
ld49/game/hud/BrainGauge.gd
Ryan d26595d527 Close issue #28
Added temper gauge with progress bar that changes from happy color to angry color
2021-10-17 16:47:27 -04:00

17 lines
531 B
GDScript

extends Control
export var color_angry:Color
export var color_calm:Color
onready var game = find_parent("Game")
func _process(delta:float) -> void:
update_bar()
func update_bar() -> void:
var length = inverse_lerp(game.temper_min, game.temper_max, game.temper)
var barHue = fmod(lerp(color_angry.h +1.0, color_calm.h, length), 1.0)
$TextureRect/ProgressBar.value = length
$TextureRect/ProgressBar.self_modulate = Color.from_hsv(barHue,lerp(color_angry.s, color_calm.s, length),lerp(color_angry.v, color_calm.v, length))