Hsif/Scripts/Death.gd

49 lines
1.3 KiB
GDScript

extends Sprite2D
var child
var selected = 0
var bigBoss = Node
# Called when the node enters the scene tree for the first time.
func _ready():
bigBoss = get_tree().get_first_node_in_group("BigBoss")
modulate.a = 0
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
if get_tree().paused == true:
if modulate.a < 1:
modulate.a += .016
if get_tree().paused == false:
modulate.a = 0
child = get_child(selected)
child.modulate.b = 0
child.modulate.g = 130
if Input.is_action_just_pressed("Down") || Input.is_action_just_pressed("Right"):
child.modulate.b = 255
child.modulate.g = 255
if get_child(selected+1) != $StartOver && get_child(selected+1) != $Quit:
selected = 0
else:
selected += 1
if Input.is_action_just_pressed("Up") || Input.is_action_just_pressed("Left"):
child.modulate.b = 255
child.modulate.g = 255
if get_child(selected-1) != $StartOver && get_child(selected-1) != $Quit:
selected = 1
else:
selected -= 1
if Input.is_action_just_pressed("Accept"):
if get_child(selected) == $StartOver:
bigBoss.scene = 1
bigBoss.switch = true
get_tree().paused = false
get_tree().paused = false
print(get_tree().paused)
if get_child(selected) == $Quit:
get_tree().quit()