2024-04-16 20:29:45 -04:00
|
|
|
extends StaticBody2D
|
|
|
|
|
|
|
|
@export var health = 10
|
|
|
|
var max_health = 10.0
|
|
|
|
|
|
|
|
func destroy():
|
|
|
|
health -= 1
|
|
|
|
|
2024-04-20 09:45:17 -04:00
|
|
|
if health == 1:
|
|
|
|
$PowerDownFX.play()
|
|
|
|
|
2024-04-16 20:29:45 -04:00
|
|
|
if health <= 0:
|
|
|
|
if not is_queued_for_deletion():
|
|
|
|
$"..".queue_free()
|
2024-04-17 15:00:20 -04:00
|
|
|
$"../../Player".aquire_exagon()
|
2024-04-16 20:29:45 -04:00
|
|
|
|
|
|
|
modulate = Color(Color.CYAN, 0.7 - lerp(0.7, 0.1, health / max_health))
|
|
|
|
|