midori-school/levels/ui/tmenu.gd

65 lines
1.8 KiB
GDScript3
Raw Normal View History

2024-01-16 03:05:25 +01:00
extends Control
2024-09-07 18:25:58 +02:00
const gamepadtest = preload("res://gamepad.gd")
2024-09-24 02:27:17 +02:00
var startbutton
2024-01-16 03:05:25 +01:00
func _ready():
2024-09-24 02:27:17 +02:00
startbutton = $VBoxContainer/Start
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
2024-01-16 03:05:25 +01:00
$VBoxContainer/Start.grab_focus()
2024-09-24 02:27:17 +02:00
if Global.dificulty != 0:
startbutton.set_text(tr("BUTTON_CONTINUE"))
2024-01-16 03:05:25 +01:00
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _level():
# This is like autoloading the scene, only
# it happens after already loading the main scene.
2024-11-04 00:29:58 +01:00
get_tree().change_scene("res://backgounds/wip.tscn")
2024-01-16 03:05:25 +01:00
#Global.live = 1
#Global.gamelevel = randi() % 3
#if Global.gamelevel == 0:
# get_tree().change_scene_to_file("res://backgounds/galaxy.tscn")
#elif Global.gamelevel == 1:
# get_tree().change_scene_to_file("res://backgounds/wormhole.tscn")
#else:
# get_tree().change_scene_to_file("res://backgounds/abstract.tscn")
#get_tree().root.add_child(title)
#get_tree().root.remove_child(boot)
#boot.queue_free()
2024-03-08 02:29:09 +01:00
func _input(event):
2024-09-07 18:25:58 +02:00
gamepadtest.new(event)
2024-03-08 02:29:09 +01:00
if Input.is_action_just_pressed("ui_cancel"):
2024-11-04 00:29:58 +01:00
get_tree().change_scene("res://title.tscn")
2024-05-19 21:12:02 +02:00
# Mouse in viewport coordinates.
2024-01-16 03:05:25 +01:00
# if Input.is_key_pressed(KEY_ENTER) || Input.is_joy_button_pressed(0,JOY_BUTTON_B):
2024-05-19 21:12:02 +02:00
# print("Mouse Click/Unclick at: ", event.position)
2024-01-16 03:05:25 +01:00
# if highlighted == 1:
# _on_debug_pressed()
# if highlighted == 2:
# _on_exit_pressed()
# else:
# _on_start_pressed()
# elif Input.is_action_pressed("ui_up"):
# focus_next
func _on_start_pressed():
2024-09-24 02:27:17 +02:00
if Global.dificulty == 0:
2024-11-04 00:29:58 +01:00
get_tree().change_scene("res://levels/ui/newgame.tscn")
2024-09-24 02:27:17 +02:00
else:
Global.live = 1
2024-11-04 00:29:58 +01:00
get_tree().change_scene("res://levels/ui/gameplay.tscn")
2024-05-19 21:12:02 +02:00
#_level()
2024-01-16 03:05:25 +01:00
#pass # Replace with function body.
func _on_debug_pressed():
2024-11-04 00:29:58 +01:00
get_tree().change_scene("res://levels/ui/settings.tscn")
2024-01-16 03:05:25 +01:00
func _on_exit_pressed():
get_tree().quit()
2024-09-26 20:42:29 +02:00
#pass # Replace with functio