Map unlocking and score saving
This commit is contained in:
@ -23,7 +23,21 @@ func _ready() -> void:
|
||||
get_node("VBoxContainer/HBoxContainer/second/Button").connect("button_up", LoadMap2)
|
||||
get_node("VBoxContainer/HBoxContainer/third/Button").connect("button_up", LoadMap3)
|
||||
|
||||
|
||||
var unlocker = true
|
||||
for i in get_node("VBoxContainer").get_children():
|
||||
for ii in i.get_children():
|
||||
if ii.get_node("Label2").text == "Haven't finished yet":
|
||||
if unlocker:
|
||||
unlocker = false
|
||||
ii.get_node("Button").get_child(0).hide()
|
||||
ii.get_node("Button").disabled = false
|
||||
else:
|
||||
ii.get_node("Button").get_child(0).show()
|
||||
ii.get_node("Button").disabled = true
|
||||
else:
|
||||
ii.get_node("Button").get_child(0).hide()
|
||||
ii.get_node("Button").disabled = false
|
||||
|
||||
|
||||
func loadData() -> void:
|
||||
if FileAccess.file_exists(save_path):
|
||||
@ -49,3 +63,8 @@ func save_scores():
|
||||
if file:
|
||||
file.store_var(map_scores)
|
||||
file.close()
|
||||
|
||||
|
||||
func _on_button_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://Game/Menu/main.tscn")
|
||||
pass # Replace with function body.
|
||||
|
||||
Reference in New Issue
Block a user