Compare commits

...

2 commits

Author SHA1 Message Date
Fabio
0d58464b3e Merge branch 'dev' into Rycarus_Menu 2024-08-17 20:45:51 +02:00
Fabio
734eda1e1f connect level select menu 2024-08-17 20:26:32 +02:00
8 changed files with 140 additions and 6 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,9 +1,14 @@
[gd_scene load_steps=5 format=3 uid="uid://t83eid7pf4iv"]
[gd_scene load_steps=7 format=3 uid="uid://t83eid7pf4iv"]
[ext_resource type="Texture2D" uid="uid://yg2u8vwwbpv1" path="res://textures/File-Icon.png" id="1_2sfn6"]
[ext_resource type="Texture2D" uid="uid://bc2ictes4mln1" path="res://textures/File-Icon-Closed.png" id="2_6ev1f"]
[ext_resource type="FontFile" uid="uid://d3pbvdemdbxes" path="res://CommodoreSixtyFour.ttf" id="3_732s0"]
[ext_resource type="Script" path="res://scripts/level_menu_level_button.gd" id="3_t0h1w"]
[ext_resource type="Texture2D" uid="uid://cp2ybylvgmek4" path="res://textures/File-Icon-Sheet.png" id="3_bbfoq"]
[ext_resource type="Script" path="res://scripts/level_menu_level_button.gd" id="3_e83yn"]
[sub_resource type="AtlasTexture" id="AtlasTexture_u313o"]
atlas = ExtResource("3_bbfoq")
region = Rect2(355, 6, 26, 24)
[node name="LevelButton" type="TextureButton"]
custom_minimum_size = Vector2(50, 50)
@ -14,9 +19,10 @@ size_flags_vertical = 3
disabled = true
texture_normal = ExtResource("1_2sfn6")
texture_disabled = ExtResource("2_6ev1f")
texture_focused = SubResource("AtlasTexture_u313o")
ignore_texture_size = true
stretch_mode = 5
script = ExtResource("3_t0h1w")
script = ExtResource("3_e83yn")
[node name="Label" type="Label" parent="."]
visible = false

View file

@ -12,7 +12,6 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_3v0vu")
script = ExtResource("2_nurro")
[node name="Background" type="TextureRect" parent="."]
@ -31,6 +30,7 @@ offset_left = 30.0
offset_top = -8.0
offset_right = 272.0
offset_bottom = 42.0
theme = ExtResource("1_3v0vu")
theme_override_font_sizes/font_size = 45
text = "level select"
horizontal_alignment = 1
@ -75,7 +75,6 @@ layout_mode = 2
[node name="LevelButton4" parent="Background/ClipControl/GridContainer" instance=ExtResource("4_0d7hu")]
layout_mode = 2
level_num = 2
[node name="LevelButton5" parent="Background/ClipControl/GridContainer" instance=ExtResource("4_0d7hu")]
layout_mode = 2

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -14,6 +14,7 @@ func level_locked() -> void:
func level_unlocked() -> void:
level_state(false)
$Label.text = str(level_num)
func level_state(value: bool) -> void:
disabled = value

View file

@ -2,11 +2,21 @@ extends Control
func _ready():
setup_level_box()
connect_level_selected_to_level_box()
func setup_level_box():
for box in $Background/ClipControl/GridContainer.get_children():
box.level_num = box.get_index() + 1
box.locked = false
box.locked = true
$Background/ClipControl/GridContainer.get_child(0).locked = false
func connect_level_selected_to_level_box():
for box in $Background/ClipControl/GridContainer.get_children():
box.connect("level_selected", change_to_scene)
func change_to_scene(level_num: int):
var next_level: String = "res://levels/level_" + str(level_num) + ".tscn"
if FileAccess.file_exists(next_level): get_tree().change_scene_to_file(next_level)
func _on_quit_button_pressed():

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB