Refactor: Added explicit typing and void return types
- Introduced explicit typing to variables and functions across multiple scripts for better code clarity. - Specified 'void' as the return type for functions that do not return a value. - Removed redundant code in some scripts.
This commit is contained in:
parent
a62cd6018e
commit
2a9e78b52e
37 changed files with 216 additions and 248 deletions
|
|
@ -1,18 +1,18 @@
|
|||
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")
|
||||
@onready var level_select : MenuButton = get_node("%MenuButton")
|
||||
@onready var high_scores : Button = get_node("%HighScores")
|
||||
@onready var exit_button : Button = get_node("%ExitGame")
|
||||
|
||||
func _ready():
|
||||
func _ready() -> void:
|
||||
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):
|
||||
func _on_item_menu_pressed(id : int) -> void:
|
||||
## Load the appropriate level based on the selection that has been made
|
||||
Log.pr(id)
|
||||
|
||||
|
|
@ -36,12 +36,12 @@ func _on_item_menu_pressed(id):
|
|||
# Load level 6
|
||||
SceneMgr.load_scene("LEVEL6")
|
||||
|
||||
func on_high_scores_pressed():
|
||||
func on_high_scores_pressed() -> void:
|
||||
## Load the high scores screen
|
||||
Log.pr("High scores button pressed")
|
||||
SceneMgr.load_scene("HIGHSCORES")
|
||||
pass
|
||||
|
||||
func on_exit_pressed():
|
||||
func on_exit_pressed() -> void:
|
||||
# Quit the game
|
||||
get_tree().quit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue