Improve Scene Loading and Input Handling

This commit is contained in:
Snoweuph 2023-04-04 02:22:56 +02:00
parent a3fb53b4ec
commit 97c467bcf4
4 changed files with 138 additions and 124 deletions

File diff suppressed because one or more lines are too long

View file

@ -52,10 +52,17 @@ layout_mode = 2
[node name="Start Button" type="Button" parent="MarginContainer/VBoxContainer/Menu Butons"]
layout_mode = 2
focus_neighbor_top = NodePath("../Quit Button")
theme = ExtResource("1_b1d2h")
theme_override_font_sizes/font_size = 96
text = "Start"
[node name="Settings Button" type="Button" parent="MarginContainer/VBoxContainer/Menu Butons"]
layout_mode = 2
theme = ExtResource("1_b1d2h")
theme_override_font_sizes/font_size = 96
text = "Settings"
[node name="About Button" type="Button" parent="MarginContainer/VBoxContainer/Menu Butons"]
layout_mode = 2
theme = ExtResource("1_b1d2h")
@ -65,6 +72,7 @@ text = "About
[node name="Quit Button" type="Button" parent="MarginContainer/VBoxContainer/Menu Butons"]
layout_mode = 2
focus_neighbor_bottom = NodePath("../Start Button")
theme = ExtResource("1_b1d2h")
theme_override_font_sizes/font_size = 96
text = "Quit"

View file

@ -6,6 +6,8 @@ extends GridContainer
@export var tile_color := TileColors.new()
var start_scene = preload("res://Scene/Main Menu.tscn").instantiate()
var tiles = []
var snake_move_vector : Vector2
var last_snake_move_vector : Vector2

View file

@ -1,5 +1,9 @@
extends Control
@onready var game_scene = load("res://Scene/Game.tscn").instantiate()
func _ready():
$"MarginContainer/VBoxContainer/Menu Butons/Start Button".grab_focus()
func _on_start_button_pressed():
get_tree().change_scene_to_file("res://Scene/Game.tscn")