mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-26 01:54:23 +00:00
Add a Main.destroy_game
function
This commit is contained in:
parent
e28097612f
commit
b5221dede1
1 changed files with 10 additions and 3 deletions
13
main.gd
13
main.gd
|
@ -28,6 +28,8 @@ var current_stage: Stage:
|
||||||
match current_stage:
|
match current_stage:
|
||||||
Stage.MENU:
|
Stage.MENU:
|
||||||
destroy_menu()
|
destroy_menu()
|
||||||
|
Stage.GAME:
|
||||||
|
destroy_game()
|
||||||
# Update the current stage
|
# Update the current stage
|
||||||
current_stage = value
|
current_stage = value
|
||||||
# Build the next scenes
|
# Build the next scenes
|
||||||
|
@ -49,19 +51,24 @@ const SCENE_GAME: PackedScene = preload("res://scenes/game/main_game.tscn")
|
||||||
var scene_menu: MainMenu = null
|
var scene_menu: MainMenu = null
|
||||||
var scene_game: MainGame = null
|
var scene_game: MainGame = null
|
||||||
|
|
||||||
## Destroy the main menu.
|
## Destroy the [MainMenu].
|
||||||
func destroy_menu() -> void:
|
func destroy_menu() -> void:
|
||||||
scene_menu.queue_free()
|
scene_menu.queue_free()
|
||||||
scene_menu = null
|
scene_menu = null
|
||||||
|
|
||||||
## Build the main menu.
|
## Build the [MainMenu].
|
||||||
func build_menu() -> void:
|
func build_menu() -> void:
|
||||||
scene_menu = SCENE_MENU.instantiate()
|
scene_menu = SCENE_MENU.instantiate()
|
||||||
scene_menu.selected_play.connect(_on_menu_selected_play)
|
scene_menu.selected_play.connect(_on_menu_selected_play)
|
||||||
scene_menu.selected_options.connect(_on_menu_selected_options)
|
scene_menu.selected_options.connect(_on_menu_selected_options)
|
||||||
container.add_child(scene_menu)
|
container.add_child(scene_menu)
|
||||||
|
|
||||||
## Build the main menu.
|
## Destroy the [MainGame].
|
||||||
|
func destroy_game() -> void:
|
||||||
|
scene_game.queue_free()
|
||||||
|
scene_game = null
|
||||||
|
|
||||||
|
## Build the [MainGame].
|
||||||
func build_game() -> void:
|
func build_game() -> void:
|
||||||
scene_game = SCENE_GAME.instantiate()
|
scene_game = SCENE_GAME.instantiate()
|
||||||
scene_game.selected_exit.connect(_on_game_selected_exit)
|
scene_game.selected_exit.connect(_on_game_selected_exit)
|
||||||
|
|
Loading…
Reference in a new issue