Hsif/Scripts/Title.gd

39 lines
1.0 KiB
GDScript3
Raw Permalink Normal View History

2024-04-09 21:28:02 -04:00
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")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
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) != $Start && 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) != $Start && get_child(selected-1) != $Quit:
selected = 1
else:
selected -= 1
if Input.is_action_just_pressed("Accept"):
if get_child(selected) == $Start:
bigBoss.scene = 1
bigBoss.switch = true
if get_child(selected) == $Quit:
get_tree().quit()