Add build directory to .gitignore, create export presets for Web and Windows Desktop, adjust z-index and mouse filter in level_1.tscn, add update_game_state function in level.gd, change main_scene path in project.godot, set rendering method to "gl_compatibility", add LevelSelect and related nodes in main_menu.tscn, create scene_manager.tscn with MainMenu node, implement functionality for menu button selection in main_menu.gd.

This commit is contained in:
Dan 2024-05-10 14:39:24 +01:00
parent ca4788ce6f
commit b6cdb68b4e
21 changed files with 499 additions and 10 deletions

View file

@ -0,0 +1,38 @@
extends Level
class_name MainMenu
@onready var level_select = get_node("%MenuButton")
@onready var high_scores = get_node("%HighScores")
@onready var exit_button = get_node("%ExitGame")
func _ready():
level_select.get_popup().id_pressed.connect(_on_item_menu_pressed)
high_scores.connect("pressed", Callable(self, "on_high_scores_pressed"))
exit_button.connect("pressed", Callable(self, "on_exit_pressed"))
update_game_state()
func _on_item_menu_pressed(id):
## Load the appropriate level based on the selection that has been made
Log.pr(id)
match id:
1:
# Load level 1
SceneMgr.load_scene("LEVEL1")
#get_tree().change_scene_to_file("res://levels/level_1.tscn")
2:
# Load level 2
SceneMgr.load_scene("LEVEL2")
3:
# Load level 3
SceneMgr.load_scene("LEVEL3")
func on_high_scores_pressed():
## Load the high scores screen
Log.pr("High scores button pressed")
pass
func on_exit_pressed():
# Quit the game
get_tree().quit()