2023-11-08 14:28:55 +11:00
|
|
|
extends Control
|
|
|
|
class_name LivesBarSegment
|
|
|
|
|
2024-02-22 06:22:22 +11:00
|
|
|
var lives_left: int = 6
|
2023-11-08 14:28:55 +11:00
|
|
|
|
2024-02-22 06:22:22 +11:00
|
|
|
func take_life(value: int) -> void:
|
|
|
|
for x: int in value:
|
2023-11-08 14:28:55 +11:00
|
|
|
lives_left -= 1
|
|
|
|
if lives_left == 5:
|
|
|
|
$AnimationPlayer.play("lose1")
|
|
|
|
if lives_left == 4:
|
|
|
|
$AnimationPlayer2.play("lose2")
|
|
|
|
if lives_left == 3:
|
|
|
|
$AnimationPlayer3.play("lose3")
|
|
|
|
if lives_left == 2:
|
|
|
|
$AnimationPlayer4.play("lose4")
|
|
|
|
if lives_left == 1:
|
|
|
|
$AnimationPlayer5.play("lose5")
|
|
|
|
if lives_left == 0:
|
|
|
|
$AnimationPlayer6.play("lose6")
|