added corpses and a wall building dissolve animation

This commit is contained in:
2023-12-10 12:05:41 +11:00
parent adde9f5c3c
commit 046c4f5afb
39 changed files with 596 additions and 112 deletions

27
Scripts/health_bar.gd Normal file

@ -0,0 +1,27 @@
extends TextureProgressBar
@export var health_bar_gradient: Gradient
@onready var prev_bar = $PreviousHealthBar
func setup(health: float):
max_value = health
value = health
prev_bar.max_value = health
prev_bar.value = health
func on_health_changed(health: float):
set_visible(true)
var health_went_down = true if health < value else false
value = health
tint_progress = health_bar_gradient.sample(value / max_value)
if health_went_down:
var tween = create_tween()
tween.set_ease(Tween.EASE_OUT)
tween.set_trans(Tween.TRANS_QUINT)
tween.tween_interval(0.3)
tween.tween_property(prev_bar, "value", value, 0.7)
else:
prev_bar.value = value