Added credits screen off of main menu
This commit is contained in:
parent
e46d1066c0
commit
bb963db15f
8 changed files with 165 additions and 29 deletions
|
|
@ -10,19 +10,17 @@ var player: CharacterBody2D
|
|||
var ui: CanvasLayer
|
||||
var game_over_ui: Control
|
||||
var menu_ui: Control
|
||||
var credits_ui: Control
|
||||
var life_icon = preload("res://Scenes/life.tscn")
|
||||
var menu_scn = preload("res://Scenes/main_menu.tscn")
|
||||
var credits_scn = preload("res://Scenes/credits.tscn")
|
||||
var game_over_scn = preload("res://Scenes/game_over.tscn")
|
||||
var ship = preload("res://Scenes/ship.tscn")
|
||||
var life = preload("res://Sounds/extra_life.wav")
|
||||
|
||||
func _ready() -> void:
|
||||
menu_ui = menu_scn.instantiate()
|
||||
menu_ui.new_game.connect(_new_game)
|
||||
menu_ui.quit_game.connect(_quit_game)
|
||||
|
||||
await get_tree().process_frame
|
||||
ui.add_child(menu_ui)
|
||||
_main_menu()
|
||||
|
||||
func set_score(amount: int):
|
||||
score = amount
|
||||
|
|
@ -84,5 +82,23 @@ func _new_game():
|
|||
|
||||
get_tree().current_scene.add_child(player)
|
||||
|
||||
func _credits():
|
||||
if menu_ui:
|
||||
menu_ui.queue_free()
|
||||
|
||||
credits_ui = credits_scn.instantiate()
|
||||
credits_ui.connect("main_menu", _main_menu)
|
||||
ui.add_child(credits_ui)
|
||||
|
||||
func _main_menu():
|
||||
if credits_ui:
|
||||
credits_ui.queue_free()
|
||||
|
||||
menu_ui = menu_scn.instantiate()
|
||||
menu_ui.new_game.connect(_new_game)
|
||||
menu_ui.credits.connect(_credits)
|
||||
menu_ui.quit_game.connect(_quit_game)
|
||||
ui.add_child(menu_ui)
|
||||
|
||||
func _quit_game():
|
||||
get_tree().quit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue