Fourth Map

This commit is contained in:
2025-09-12 15:46:49 +02:00
parent 2f9b0623f4
commit 6475051908
8 changed files with 2079 additions and 9 deletions

View File

@ -16,12 +16,17 @@ func LoadMap3() -> void:
get_tree().change_scene_to_file("res://Game/Maps/map_3.tscn")
pass # Replace with function body.
func LoadMap4() -> void:
get_tree().change_scene_to_file("res://Game/Maps/map_4.tscn")
pass # Replace with function body.
func _ready() -> void:
loadData()
get_node("VBoxContainer/HBoxContainer/first/Button").connect("button_up", LoadMap1)
get_node("VBoxContainer/HBoxContainer/second/Button").connect("button_up", LoadMap2)
get_node("VBoxContainer/HBoxContainer/third/Button").connect("button_up", LoadMap3)
get_node("VBoxContainer/HBoxContainer/fourth/Button").connect("button_up", LoadMap4)
var unlocker = true
for i in get_node("VBoxContainer").get_children():
@ -42,17 +47,21 @@ func _ready() -> void:
func loadData() -> void:
if FileAccess.file_exists(save_path):
var file = FileAccess.open(save_path, FileAccess.READ)
if file:
map_scores = file.get_var()
print(map_scores)
file.close()
get_node("VBoxContainer/HBoxContainer/first/Label2").text = "Haven't finished yet" if map_scores["Map1"] == 0 else "Scored: " + str(map_scores["Map1"]) + " out of 10"
get_node("VBoxContainer/HBoxContainer/second/Label2").text = "Haven't finished yet" if map_scores["Map2"] == 0 else "Scored: " + str(map_scores["Map2"]) + " out of 10"
get_node("VBoxContainer/HBoxContainer/third/Label2").text = "Haven't finished yet" if map_scores["Map3"] == 0 else "Scored: " + str(map_scores["Map3"]) + " out of 10"
get_node("VBoxContainer/HBoxContainer/fourth/Label2").text = "Haven't finished yet" if map_scores["Map4"] == 0 else "Scored: " + str(map_scores["Map4"]) + " out of 10"
else:
map_scores["Map1"] = 0
map_scores["Map2"] = 0
map_scores["Map3"] = 0
map_scores["Map4"] = 0
save_scores()
loadData()