36 lines
745 B
GDScript
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
|