This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
Jessist/Scripts/BossHealth.gd
2022-06-18 13:05:48 +02:00

36 lines
745 B
GDScript

extends ProgressBar
export (int) var hpFull = 0
export (int) var hp = 0
export (float) var hpMulti = 0
var hpFastness = 15
var hpPrev = 0
var inAnimationHp = 0
var inAnimation = false
func _ready():
gameController.logCall("BossHealth","_ready",null)
value = 1000
func _process(_delta):
if inAnimation:
if inAnimationHp == (hpMulti * hpPrev):
inAnimation = false
elif inAnimationHp <= (hpMulti * hpPrev):
inAnimation = false
inAnimationHp = hpMulti * hpPrev
else:
inAnimationHp -= hpFastness
value = inAnimationHp
else:
if not hp == hpPrev:
inAnimation = true
inAnimationHp = value
hpPrev = hp
$Particles.emitting = true
func setHp(shp,shpMulti):
hp = shp
hpFull = hp
hpMulti = shpMulti
hpPrev = shp