diff --git a/AllCapsEntry.gd b/AllCapsEntry.gd index c2edea3..52c265d 100644 --- a/AllCapsEntry.gd +++ b/AllCapsEntry.gd @@ -6,7 +6,7 @@ func _ready() -> void: func _on_text_changed(new_text : String) -> void: var caret_pos = caret_column - text = new_text.to_upper().replace(" ", "") + text = new_text.to_upper() caret_column = caret_pos func _on_text_submitted(new_text : String) -> void: diff --git a/ArkaLabel.gd b/ArkaLabel.gd new file mode 100644 index 0000000..73bd6a5 --- /dev/null +++ b/ArkaLabel.gd @@ -0,0 +1,20 @@ +@tool +extends Label + +class_name ArkaLabel + +func _ready() -> void: + set_notify_transform(true) + material = load("res://ArkanoidMaterial.tres").duplicate() + theme = load("res://MainTheme.tres") + theme_type_variation = "Arkanoid" + material.set_shader_parameter("rect_global_position", global_position / get_viewport_rect().size) + material.set_shader_parameter("rect_size", get_rect().size) + +func _notification(what: int) -> void: + if what == NOTIFICATION_TRANSFORM_CHANGED: + var pos = global_position / get_viewport_rect().size + print(pos) + material.set_shader_parameter("rect_global_position", pos) + material.set_shader_parameter("rect_size", get_rect().size) + diff --git a/Arkanoid.gdshader b/Arkanoid.gdshader index 72ce966..3fe1885 100644 --- a/Arkanoid.gdshader +++ b/Arkanoid.gdshader @@ -1,14 +1,25 @@ shader_type canvas_item; +uniform sampler2D ColourTexture; +uniform vec2 rect_global_position; +uniform vec2 rect_size; void vertex() { - // Called for every vertex the material is visible on. } void fragment() { - // Called for every pixel the material is visible on. - if (COLOR.rgba == vec4(1.0, 0.0, 1.0, 1.0)) { - COLOR.rgb = vec3(UV.y * 8.0, UV.y * 6.0, 1.0 - (UV.y * 14.0)); +// float b = (COLOR.r + COLOR.g + COLOR.b) / 3.0; +// COLOR.rgb = texture(ColourTexture, UV).rgb * vec3(b, b, b); + + if ((COLOR.r > 0.8) && (COLOR.g > 0.8) && (COLOR.b < 0.2) && (COLOR.a > 0.9)) { + vec2 actual_uv = (SCREEN_UV - rect_global_position) * rect_size; + COLOR.rgb = texture(ColourTexture, actual_uv).rgb ; } +// if (COLOR.rgba == vec4(1.0, 0.0, 1.0, 1.0)) { +// if (COLOR.a > 0.9) { +// COLOR.rgb = texture(ColourTexture, UV).rgb; +// COLOR.rgb = vec3(UV.y * 8.0, UV.y * 6.0, 1.0 - (UV.y * 14.0)); +// COLOR.rgb = vec3(UV.x, UV.x, UV.x); +// } } //void light() { diff --git a/ArkanoidMaterial.tres b/ArkanoidMaterial.tres index 0f424e1..4f32aa8 100644 --- a/ArkanoidMaterial.tres +++ b/ArkanoidMaterial.tres @@ -1,6 +1,8 @@ -[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://bv4vhjg83fqpn"] +[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://bv4vhjg83fqpn"] [ext_resource type="Shader" path="res://Arkanoid.gdshader" id="1_otqlg"] +[ext_resource type="Texture2D" uid="uid://b56kjbt4ub52n" path="res://NoidTex.png" id="2_rlu6f"] [resource] shader = ExtResource("1_otqlg") +shader_parameter/ColourTexture = ExtResource("2_rlu6f") diff --git a/Bullet.tscn b/Bullet.tscn index c09a14c..4951bb7 100644 --- a/Bullet.tscn +++ b/Bullet.tscn @@ -39,7 +39,7 @@ hue_variation_max = 1.0 [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] stream = ExtResource("3_of1j8") -volume_db = -11.243 +volume_db = -1.874 autoplay = true bus = &"Effects" diff --git a/Dunkanoid.gd b/Dunkanoid.gd index 81a348c..c8580d9 100644 --- a/Dunkanoid.gd +++ b/Dunkanoid.gd @@ -55,6 +55,8 @@ var level_starting : bool = false var time_run : bool = false func _ready() -> void: + level = Global.start_level + if Global.relative_mouse: Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) else: diff --git a/Dunkanoid.tscn b/Dunkanoid.tscn index 19e7ac7..8c5b26f 100644 --- a/Dunkanoid.tscn +++ b/Dunkanoid.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=27 format=3 uid="uid://4q0epdnb0x4s"] +[gd_scene load_steps=31 format=3 uid="uid://4q0epdnb0x4s"] [ext_resource type="Script" path="res://Dunkanoid.gd" id="1_kv4if"] [ext_resource type="PackedScene" uid="uid://dndemjw7up2r6" path="res://Paddle/Paddle.tscn" id="2_26c5i"] @@ -10,11 +10,13 @@ [ext_resource type="AudioStream" uid="uid://bojc0es7165ed" path="res://Sounds/Collected.wav" id="8_fpbsr"] [ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="8_wcf7g"] [ext_resource type="AudioStream" uid="uid://cpf0y72o6wrv2" path="res://Sounds/AlienDie.wav" id="9_lt28f"] -[ext_resource type="Material" uid="uid://bv4vhjg83fqpn" path="res://ArkanoidMaterial.tres" id="9_ouuij"] [ext_resource type="Script" path="res://Paused.gd" id="12_8qv0d"] +[ext_resource type="Shader" path="res://Arkanoid.gdshader" id="12_ljnes"] [ext_resource type="Script" path="res://RunTimer.gd" id="12_nyw3s"] [ext_resource type="Script" path="res://Pipes.gd" id="13_12te1"] +[ext_resource type="Texture2D" uid="uid://b56kjbt4ub52n" path="res://NoidTex.png" id="13_u52d1"] [ext_resource type="Texture2D" uid="uid://biqt5k34w683i" path="res://Pipes/vPipe.png" id="14_33cmo"] +[ext_resource type="Script" path="res://ArkaLabel.gd" id="14_ovrv2"] [ext_resource type="Texture2D" uid="uid://cg5olju1mcceh" path="res://Pipes/hPipe.png" id="15_n2p48"] [ext_resource type="Texture2D" uid="uid://bh8om6bv1qumy" path="res://Pipes/vPipeEndLow.png" id="16_osyku"] [ext_resource type="Texture2D" uid="uid://n81u6nrroi18" path="res://Pipes/CornerTopLeft.png" id="17_jvxfq"] @@ -38,6 +40,18 @@ distance = -432.0 [sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_48dqy"] distance = -360.0 +[sub_resource type="ShaderMaterial" id="ShaderMaterial_xvkhj"] +shader = ExtResource("12_ljnes") +shader_parameter/rect_global_position = Vector2(0, 0.30621) +shader_parameter/rect_size = Vector2(448, 25) +shader_parameter/ColourTexture = ExtResource("13_u52d1") + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_j13aj"] +shader = ExtResource("12_ljnes") +shader_parameter/rect_global_position = Vector2(0, 0) +shader_parameter/rect_size = Vector2(89, 25) +shader_parameter/ColourTexture = ExtResource("13_u52d1") + [node name="Dunkanoid" type="Node2D"] texture_filter = 1 script = ExtResource("1_kv4if") @@ -302,13 +316,14 @@ theme_type_variation = &"RoundStart" layout_mode = 2 [node name="Title" type="Label" parent="Start/VBoxContainer/PanelContainer/VBoxContainer"] -material = ExtResource("9_ouuij") +material = SubResource("ShaderMaterial_xvkhj") layout_mode = 2 theme = ExtResource("8_wcf7g") theme_type_variation = &"Arkanoid" text = "DUNKANOID" horizontal_alignment = 1 vertical_alignment = 1 +script = ExtResource("14_ovrv2") [node name="Round" type="Label" parent="Start/VBoxContainer/PanelContainer/VBoxContainer"] layout_mode = 2 @@ -349,13 +364,14 @@ size_flags_vertical = 3 theme = ExtResource("8_wcf7g") [node name="Label" type="Label" parent="Paused/VBoxContainer"] -material = ExtResource("9_ouuij") +material = SubResource("ShaderMaterial_j13aj") layout_mode = 2 theme = ExtResource("8_wcf7g") theme_type_variation = &"Arkanoid" text = "PAUSED" horizontal_alignment = 1 vertical_alignment = 1 +script = ExtResource("14_ovrv2") [node name="HBoxContainer" type="HBoxContainer" parent="Paused/VBoxContainer"] layout_mode = 2 diff --git a/ExitButton.gd b/ExitButton.gd new file mode 100644 index 0000000..a85e3c9 --- /dev/null +++ b/ExitButton.gd @@ -0,0 +1,4 @@ +extends HBoxContainer + +func _ready() -> void: + visible = not OS.has_feature("web") diff --git a/GameOver.gd b/GameOver.gd index e9994c4..a8fa0eb 100644 --- a/GameOver.gd +++ b/GameOver.gd @@ -10,7 +10,7 @@ func _on_timer_timeout() -> void: get_tree().change_scene_to_file("res://Intro.tscn") func _on_update_score(score : int) -> void: - $VBoxContainer/ScoreBox.text = "%08d" % score + $VBoxContainer/HBoxContainer/ScoreBox.text = "%08d" % score func _on_game_over_sound_finished() -> void: diff --git a/GameOver.tscn b/GameOver.tscn index d179fec..6bad041 100644 --- a/GameOver.tscn +++ b/GameOver.tscn @@ -1,8 +1,16 @@ -[gd_scene load_steps=4 format=3 uid="uid://c3ikcjhbrm0hp"] +[gd_scene load_steps=7 format=3 uid="uid://c3ikcjhbrm0hp"] [ext_resource type="Script" path="res://GameOver.gd" id="1_clfqa"] [ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="3_km2fx"] -[ext_resource type="Material" uid="uid://bv4vhjg83fqpn" path="res://ArkanoidMaterial.tres" id="4_et3vd"] +[ext_resource type="Shader" path="res://Arkanoid.gdshader" id="3_u76hk"] +[ext_resource type="Texture2D" uid="uid://b56kjbt4ub52n" path="res://NoidTex.png" id="4_lxs2b"] +[ext_resource type="Script" path="res://ArkaLabel.gd" id="5_g14o8"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_qq8am"] +shader = ExtResource("3_u76hk") +shader_parameter/rect_global_position = Vector2(0, 0.205567) +shader_parameter/rect_size = Vector2(640, 25) +shader_parameter/ColourTexture = ExtResource("4_lxs2b") [node name="GameOver" type="Node2D"] texture_filter = 1 @@ -23,13 +31,14 @@ size_flags_vertical = 3 theme = ExtResource("3_km2fx") [node name="GameOver" type="Label" parent="VBoxContainer"] -material = ExtResource("4_et3vd") +material = SubResource("ShaderMaterial_qq8am") layout_mode = 2 theme = ExtResource("3_km2fx") theme_type_variation = &"Arkanoid" text = "GAME OVER" horizontal_alignment = 1 vertical_alignment = 1 +script = ExtResource("5_g14o8") [node name="VSeparator2" type="VSeparator" parent="VBoxContainer"] layout_mode = 2 diff --git a/Global.gd b/Global.gd index bee2d8b..3f69dc3 100644 --- a/Global.gd +++ b/Global.gd @@ -34,6 +34,8 @@ var effects_volume : int : var best_times : Dictionary +var start_level : String = "DUNKANOID" + var _loading : bool = false func _ready() -> void: diff --git a/Intro.gd b/Intro.gd index ee61dae..de77954 100644 --- a/Intro.gd +++ b/Intro.gd @@ -17,7 +17,7 @@ func _ready() -> void: EventBus.update_highscore.connect(_on_update_highscore) _on_update_score(Global.score) _on_update_highscore(Global.highscore) - $VBoxContainer/HBoxContainer/Play.grab_focus() + $VBoxContainer/Play/Play.grab_focus() Music.play_intro() get_tree().create_timer(5).timeout.connect(_show_credits) @@ -47,6 +47,7 @@ func _hide_credits_done() -> void: get_tree().create_timer(1).timeout.connect(_show_credits) func _on_button_pressed() -> void: + Global.start_level = "DUNKANOID" get_tree().change_scene_to_file("res://Dunkanoid.tscn") @@ -75,3 +76,11 @@ func dump_all(dir : String, indent : String = "") -> void: for file in DirAccess.get_files_at(dir): print("%s%s" % [indent, file]) + + +func _on_play_level_pressed() -> void: + $LoadPanel.show_panel(true) + +func _on_load_panel_load_level(level_name: String) -> void: + Global.start_level = level_name + get_tree().change_scene_to_file("res://Dunkanoid.tscn") diff --git a/Intro.tscn b/Intro.tscn index a56b9de..ace58b6 100644 --- a/Intro.tscn +++ b/Intro.tscn @@ -1,8 +1,11 @@ -[gd_scene load_steps=6 format=3 uid="uid://c2oboya05agti"] +[gd_scene load_steps=9 format=3 uid="uid://c2oboya05agti"] [ext_resource type="Script" path="res://Intro.gd" id="1_1hnh1"] [ext_resource type="Material" uid="uid://bv4vhjg83fqpn" path="res://ArkanoidMaterial.tres" id="2_a44d8"] [ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="3_8d2ix"] +[ext_resource type="Script" path="res://ArkaLabel.gd" id="3_dqq2b"] +[ext_resource type="Script" path="res://ExitButton.gd" id="4_ty0na"] +[ext_resource type="PackedScene" uid="uid://deyotp28r4uwj" path="res://LoadPanel.tscn" id="5_esv62"] [sub_resource type="Curve" id="Curve_jhhjd"] min_value = -200.0 @@ -34,29 +37,10 @@ color_ramp = SubResource("Gradient_431mb") hue_variation_max = 1.0 [node name="VBoxContainer" type="VBoxContainer" parent="."] -offset_top = 104.0 offset_right = 640.0 -offset_bottom = 232.0 +offset_bottom = 297.0 -[node name="Dunkanoid" type="Label" parent="VBoxContainer"] -material = ExtResource("2_a44d8") -layout_mode = 2 -theme = ExtResource("3_8d2ix") -theme_type_variation = &"Arkanoid" -text = "DUNKANOID" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="Revenge" type="Label" parent="VBoxContainer"] -material = ExtResource("2_a44d8") -layout_mode = 2 -theme = ExtResource("3_8d2ix") -theme_type_variation = &"Arkanoid" -text = "REVENGE OF AAH" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="VSeparator" type="VSeparator" parent="VBoxContainer"] +[node name="VSeparator3" type="VSeparator" parent="VBoxContainer"] layout_mode = 2 size_flags_vertical = 3 theme = ExtResource("3_8d2ix") @@ -69,11 +53,13 @@ layout_mode = 2 size_flags_horizontal = 3 theme = ExtResource("3_8d2ix") -[node name="Play" type="Button" parent="VBoxContainer/HBoxContainer"] +[node name="ArkaLabel" type="Label" parent="VBoxContainer/HBoxContainer"] +material = ExtResource("2_a44d8") layout_mode = 2 theme = ExtResource("3_8d2ix") -text = "PLAY" -icon_alignment = 1 +theme_type_variation = &"Arkanoid" +text = "DUNKANOID" +script = ExtResource("3_dqq2b") [node name="HSeparator2" type="HSeparator" parent="VBoxContainer/HBoxContainer"] layout_mode = 2 @@ -88,55 +74,125 @@ layout_mode = 2 size_flags_horizontal = 3 theme = ExtResource("3_8d2ix") -[node name="Settings" type="Button" parent="VBoxContainer/HBoxContainer2"] +[node name="Revenge" type="Label" parent="VBoxContainer/HBoxContainer2"] +material = ExtResource("2_a44d8") layout_mode = 2 theme = ExtResource("3_8d2ix") -text = "SETTINGS" -icon_alignment = 1 +theme_type_variation = &"Arkanoid" +text = "REVENGE OF AAH" +script = ExtResource("3_dqq2b") [node name="HSeparator2" type="HSeparator" parent="VBoxContainer/HBoxContainer2"] layout_mode = 2 size_flags_horizontal = 3 theme = ExtResource("3_8d2ix") -[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer"] +[node name="VSeparator" type="VSeparator" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme = ExtResource("3_8d2ix") + +[node name="Play" type="HBoxContainer" parent="VBoxContainer"] layout_mode = 2 -[node name="HSeparator" type="HSeparator" parent="VBoxContainer/HBoxContainer3"] +[node name="HSeparator" type="HSeparator" parent="VBoxContainer/Play"] layout_mode = 2 size_flags_horizontal = 3 theme = ExtResource("3_8d2ix") -[node name="Editor" type="Button" parent="VBoxContainer/HBoxContainer3"] +[node name="Play" type="Button" parent="VBoxContainer/Play"] +layout_mode = 2 +theme = ExtResource("3_8d2ix") +text = "PLAY" +icon_alignment = 1 + +[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/Play"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("3_8d2ix") + +[node name="PlayLevel" type="HBoxContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="HSeparator" type="HSeparator" parent="VBoxContainer/PlayLevel"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("3_8d2ix") + +[node name="PlayLevel" type="Button" parent="VBoxContainer/PlayLevel"] +layout_mode = 2 +theme = ExtResource("3_8d2ix") +text = "PLAY LEVEL" +icon_alignment = 1 + +[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/PlayLevel"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("3_8d2ix") + +[node name="LevelEditor" type="HBoxContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="HSeparator" type="HSeparator" parent="VBoxContainer/LevelEditor"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("3_8d2ix") + +[node name="Editor" type="Button" parent="VBoxContainer/LevelEditor"] layout_mode = 2 theme = ExtResource("3_8d2ix") text = "LEVEL EDITOR" icon_alignment = 1 -[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/HBoxContainer3"] +[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/LevelEditor"] layout_mode = 2 size_flags_horizontal = 3 theme = ExtResource("3_8d2ix") -[node name="HBoxContainer4" type="HBoxContainer" parent="VBoxContainer"] +[node name="Settings" type="HBoxContainer" parent="VBoxContainer"] layout_mode = 2 -[node name="HSeparator" type="HSeparator" parent="VBoxContainer/HBoxContainer4"] +[node name="HSeparator" type="HSeparator" parent="VBoxContainer/Settings"] layout_mode = 2 size_flags_horizontal = 3 theme = ExtResource("3_8d2ix") -[node name="Exit" type="Button" parent="VBoxContainer/HBoxContainer4"] +[node name="Settings" type="Button" parent="VBoxContainer/Settings"] +layout_mode = 2 +theme = ExtResource("3_8d2ix") +text = "SETTINGS" +icon_alignment = 1 + +[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/Settings"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("3_8d2ix") + +[node name="ExitButton" type="HBoxContainer" parent="VBoxContainer"] +layout_mode = 2 +script = ExtResource("4_ty0na") + +[node name="HSeparator" type="HSeparator" parent="VBoxContainer/ExitButton"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("3_8d2ix") + +[node name="Exit" type="Button" parent="VBoxContainer/ExitButton"] layout_mode = 2 theme = ExtResource("3_8d2ix") text = "EXIT" icon_alignment = 1 -[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/HBoxContainer4"] +[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/ExitButton"] layout_mode = 2 size_flags_horizontal = 3 theme = ExtResource("3_8d2ix") +[node name="VSeparator2" type="VSeparator" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme = ExtResource("3_8d2ix") + [node name="HBoxContainer" type="HBoxContainer" parent="."] offset_left = 18.0 offset_top = 297.0 @@ -192,7 +248,15 @@ text = "00000000" horizontal_alignment = 2 vertical_alignment = 1 -[connection signal="pressed" from="VBoxContainer/HBoxContainer/Play" to="." method="_on_button_pressed"] -[connection signal="pressed" from="VBoxContainer/HBoxContainer2/Settings" to="." method="_on_settings_pressed"] -[connection signal="pressed" from="VBoxContainer/HBoxContainer3/Editor" to="." method="_on_editor_pressed"] -[connection signal="pressed" from="VBoxContainer/HBoxContainer4/Exit" to="." method="_on_exit_pressed"] +[node name="LoadPanel" parent="." instance=ExtResource("5_esv62")] +offset_left = 239.0 +offset_top = 116.0 +offset_right = 399.0 +offset_bottom = 297.0 + +[connection signal="pressed" from="VBoxContainer/Play/Play" to="." method="_on_button_pressed"] +[connection signal="pressed" from="VBoxContainer/PlayLevel/PlayLevel" to="." method="_on_play_level_pressed"] +[connection signal="pressed" from="VBoxContainer/LevelEditor/Editor" to="." method="_on_editor_pressed"] +[connection signal="pressed" from="VBoxContainer/Settings/Settings" to="." method="_on_settings_pressed"] +[connection signal="pressed" from="VBoxContainer/ExitButton/Exit" to="." method="_on_exit_pressed"] +[connection signal="load_level" from="LoadPanel" to="." method="_on_load_panel_load_level"] diff --git a/LevelEditor.tscn b/LevelEditor.tscn index b3afbf2..74b5819 100644 --- a/LevelEditor.tscn +++ b/LevelEditor.tscn @@ -7,8 +7,8 @@ [ext_resource type="Script" path="res://AllCapsEntry.gd" id="5_aqqxj"] [ext_resource type="Script" path="res://LevelSelector.gd" id="6_brm2b"] [ext_resource type="Script" path="res://BackgroundSelector.gd" id="7_x1vot"] -[ext_resource type="Script" path="res://LoadPanel.gd" id="8_0o6x4"] [ext_resource type="Script" path="res://HexOnly.gd" id="8_72pke"] +[ext_resource type="PackedScene" uid="uid://deyotp28r4uwj" path="res://LoadPanel.tscn" id="9_joiqc"] [ext_resource type="Script" path="res://ExportPanel.gd" id="9_nmcps"] [ext_resource type="Script" path="res://ImportPanel.gd" id="10_q6s0l"] @@ -2077,35 +2077,7 @@ focus_mode = 0 theme = ExtResource("4_usb0o") text = "EXIT" -[node name="LoadPanel" type="PanelContainer" parent="."] -visible = false -offset_left = 464.0 -offset_right = 624.0 -offset_bottom = 360.0 -theme = ExtResource("4_usb0o") -script = ExtResource("8_0o6x4") - -[node name="VBoxContainer" type="VBoxContainer" parent="LoadPanel"] -layout_mode = 2 - -[node name="ScrollContainer" type="ScrollContainer" parent="LoadPanel/VBoxContainer"] -layout_mode = 2 -size_flags_vertical = 3 - -[node name="VBoxContainer" type="VBoxContainer" parent="LoadPanel/VBoxContainer/ScrollContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -size_flags_vertical = 3 - -[node name="HBoxContainer" type="HBoxContainer" parent="LoadPanel/VBoxContainer"] -layout_mode = 2 - -[node name="Cancel" type="Button" parent="LoadPanel/VBoxContainer/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 3 -focus_mode = 0 -theme = ExtResource("4_usb0o") -text = "CANCEL" +[node name="LoadPanel" parent="." instance=ExtResource("9_joiqc")] [node name="ExportPanel" type="PanelContainer" parent="."] visible = false @@ -2174,8 +2146,6 @@ text = "CANCEL" [connection signal="pressed" from="VBoxContainer/HBoxContainer3/Export" to="." method="_on_export_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer2/New" to="." method="_on_new_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer2/Exit" to="." method="_on_exit_pressed"] -[connection signal="load_file" from="LoadPanel" to="." method="_on_load_panel_load_file"] -[connection signal="pressed" from="LoadPanel/VBoxContainer/HBoxContainer/Cancel" to="LoadPanel" method="_on_cancel_pressed"] [connection signal="pressed" from="ExportPanel/VBoxContainer/Close" to="ExportPanel" method="_on_close_pressed"] [connection signal="object_imported" from="ImportPanel" to="." method="_on_import_panel_object_imported"] [connection signal="pressed" from="ImportPanel/VBoxContainer/HBoxContainer/Import" to="ImportPanel" method="_on_import_pressed"] diff --git a/LoadPanel.gd b/LoadPanel.gd index 4254ee3..7ecfe9e 100644 --- a/LoadPanel.gd +++ b/LoadPanel.gd @@ -1,8 +1,12 @@ extends PanelContainer signal load_file(filename : String) +signal load_level(level_name : String) + +func update_level_list(unique : bool = false) -> void: + + var list : Array[String] = [] -func update_level_list() -> void: var vb = $VBoxContainer/ScrollContainer/VBoxContainer for k in vb.get_children(): @@ -19,11 +23,16 @@ func update_level_list() -> void: b.size_flags_horizontal = Control.SIZE_EXPAND_FILL b.pressed.connect(_on_load_file_pressed.bind(b)) b.set_meta("filename", "user://Levels/%s" % file) + b.set_meta("level_name", data.name) b.icon = load("res://Icons/User.png") vb.add_child(b) + list.push_back(data.name) for file in DirAccess.get_files_at("res://Levels"): if file.ends_with(".json"): var data = JSON.parse_string(FileAccess.get_file_as_string("res://Levels/%s" % file)) + if unique: + if list.has(data.name): + continue var b = Button.new() b.theme = load("res://MainTheme.tres") b.theme_type_variation = "InternalFile" @@ -31,12 +40,12 @@ func update_level_list() -> void: b.size_flags_horizontal = Control.SIZE_EXPAND_FILL b.pressed.connect(_on_load_file_pressed.bind(b)) b.set_meta("filename", "res://Levels/%s" % file) + b.set_meta("level_name", data.name) b.icon = load("res://Icons/Internal.png") vb.add_child(b) - -func show_panel() -> void: - update_level_list() +func show_panel(unique : bool = false) -> void: + update_level_list(unique) visible = true func _on_cancel_pressed() -> void: @@ -44,4 +53,5 @@ func _on_cancel_pressed() -> void: func _on_load_file_pressed(node): load_file.emit(node.get_meta("filename")) + load_level.emit(node.get_meta("level_name")) visible = false diff --git a/LoadPanel.tscn b/LoadPanel.tscn new file mode 100644 index 0000000..6534529 --- /dev/null +++ b/LoadPanel.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=3 format=3 uid="uid://deyotp28r4uwj"] + +[ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="1_v1yul"] +[ext_resource type="Script" path="res://LoadPanel.gd" id="2_rj17x"] + +[node name="LoadPanel" type="PanelContainer"] +visible = false +offset_left = 464.0 +offset_right = 624.0 +offset_bottom = 360.0 +theme = ExtResource("1_v1yul") +script = ExtResource("2_rj17x") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 2 + +[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/ScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="Cancel" type="Button" parent="VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +focus_mode = 0 +theme = ExtResource("1_v1yul") +text = "CANCEL" + +[connection signal="pressed" from="VBoxContainer/HBoxContainer/Cancel" to="." method="_on_cancel_pressed"] diff --git a/MainTheme.tres b/MainTheme.tres index 974fb0c..4eababa 100644 --- a/MainTheme.tres +++ b/MainTheme.tres @@ -96,6 +96,12 @@ shadow_size = 10 [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_sf0ln"] bg_color = Color(0, 0, 0, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +shadow_color = Color(1, 0.701961, 0.172549, 0.247059) +shadow_size = 3 [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mruxx"] content_margin_top = 20.0 @@ -108,9 +114,13 @@ shadow_size = 25 [resource] Arkanoid/base_type = &"Label" -Arkanoid/colors/font_color = Color(1, 0, 1, 1) -Arkanoid/colors/font_outline_color = Color(1, 0.647059, 0, 1) +Arkanoid/colors/font_color = Color(1, 1, 0, 1) +Arkanoid/colors/font_outline_color = Color(0.85098, 0.647059, 0, 0.721569) +Arkanoid/colors/font_shadow_color = Color(0.917647, 0.427451, 0, 0.615686) Arkanoid/constants/outline_size = 2 +Arkanoid/constants/shadow_offset_x = 0 +Arkanoid/constants/shadow_offset_y = 0 +Arkanoid/constants/shadow_outline_size = 6 Arkanoid/font_sizes/font_size = 24 Arkanoid/fonts/font = ExtResource("1_s07ae") Button/font_sizes/font_size = 20 diff --git a/NoidTex.png b/NoidTex.png new file mode 100644 index 0000000..f44ddf8 Binary files /dev/null and b/NoidTex.png differ diff --git a/NoidTex.png.import b/NoidTex.png.import new file mode 100644 index 0000000..fbf0a18 --- /dev/null +++ b/NoidTex.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b56kjbt4ub52n" +path="res://.godot/imported/NoidTex.png-84783a388fea7cdf21fdee3a0c8bb898.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://NoidTex.png" +dest_files=["res://.godot/imported/NoidTex.png-84783a388fea7cdf21fdee3a0c8bb898.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/project.godot b/project.godot index 0ddd657..02973a8 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="Dunkanoid" -config/version="0.7.0" +config/version="0.7.2" run/main_scene="res://Intro.tscn" config/features=PackedStringArray("4.2", "Forward Plus") run/max_fps=30