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()

View File

@ -237,6 +237,42 @@ layout_mode = 2
size_flags_horizontal = 4
text = "Score: 10 / "
[node name="fourth" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
alignment = 1
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer/fourth"]
layout_mode = 2
size_flags_horizontal = 4
text = "3rd Level"
[node name="Button" type="Button" parent="VBoxContainer/HBoxContainer/fourth"]
custom_minimum_size = Vector2(120, 80)
layout_mode = 2
theme_override_styles/disabled = SubResource("StyleBoxTexture_44oc2")
theme_override_styles/hover = SubResource("StyleBoxTexture_losb8")
theme_override_styles/normal = SubResource("StyleBoxTexture_44oc2")
[node name="TextureRect" type="TextureRect" parent="VBoxContainer/HBoxContainer/fourth/Button"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -20.0
offset_top = -20.0
offset_right = 20.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("6_udeaf")
[node name="Label2" type="Label" parent="VBoxContainer/HBoxContainer/fourth"]
layout_mode = 2
size_flags_horizontal = 4
text = "Score: 10 / "
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 12