menu and level select ready
This commit is contained in:
parent
311c0395ab
commit
f470efbe1f
10 changed files with 61 additions and 11 deletions
|
|
@ -5,9 +5,16 @@ var credits_shown : bool = false
|
|||
@export var level_node : Control
|
||||
@export var credits_node : Control
|
||||
@export var credits_button : Button
|
||||
@export var levels_vbox : VBoxContainer
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
for level_num in GameManager.levels.size():
|
||||
var new_button : Button = Button.new()
|
||||
new_button.text = "Level " + str(level_num) + " : " + GameManager.levels[level_num].level_name
|
||||
new_button.pressed.connect(func(): pick_level(GameManager.levels[level_num].level_name))
|
||||
levels_vbox.add_child(new_button)
|
||||
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
|
|
@ -23,6 +30,11 @@ func _process(delta):
|
|||
credits_button.text = "Credits"
|
||||
|
||||
|
||||
func pick_level(picked_level:String):
|
||||
for level in GameManager.levels:
|
||||
if level.level_name == picked_level:
|
||||
get_tree().change_scene_to_file(level.level_path)
|
||||
|
||||
func _on_credits_button_pressed():
|
||||
credits_shown = !credits_shown
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue