From c2a692c0822168b5de54b3e092c41dd31a20452f Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 2 Oct 2022 15:32:40 +0200 Subject: [PATCH] Polishing and bugfixing --- project.godot | 1 + src/Main.tscn | 50 ++----------------- src/scenes/Gameplay.tscn | 6 +++ src/scenes/Menu.tscn | 104 +++++++++++++++++++++++---------------- src/scenes/Play Area.gd | 21 ++++---- 5 files changed, 82 insertions(+), 100 deletions(-) diff --git a/project.godot b/project.godot index a1ead98..d9b9659 100644 --- a/project.godot +++ b/project.godot @@ -11,6 +11,7 @@ config_version=4 [application] config/name="Particle Clash" +config/description="[LD51 Compo] A match-4 game about particles about to collide." run/main_scene="res://src/Main.tscn" boot_splash/show_image=false config/icon="res://src/sprites/atom.png" diff --git a/src/Main.tscn b/src/Main.tscn index a3ec387..3046002 100644 --- a/src/Main.tscn +++ b/src/Main.tscn @@ -207,49 +207,7 @@ script = ExtResource( 5 ) position = Vector2( 800, 450 ) [node name="Menu" parent="." instance=ExtResource( 1 )] - -[node name="Title" parent="Menu/VBoxContainer" index="0"] -margin_top = 78.0 -margin_right = 1600.0 -margin_bottom = 136.0 - -[node name="Title2" parent="Menu/VBoxContainer" index="1"] -margin_top = 140.0 -margin_right = 1600.0 -margin_bottom = 170.0 - -[node name="Padding" parent="Menu/VBoxContainer" index="2"] -margin_top = 174.0 -margin_right = 1600.0 -margin_bottom = 214.0 - -[node name="Colors" parent="Menu/VBoxContainer" index="3"] -margin_top = 218.0 -margin_right = 1600.0 -margin_bottom = 726.0 - -[node name="Left Player" parent="Menu/VBoxContainer/Colors" index="0"] -margin_left = 304.0 -margin_right = 724.0 - -[node name="Vs" parent="Menu/VBoxContainer/Colors" index="1"] -margin_left = 728.0 -margin_right = 872.0 - -[node name="Right Player" parent="Menu/VBoxContainer/Colors" index="2"] -margin_left = 876.0 -margin_right = 1296.0 - -[node name="Padding2" parent="Menu/VBoxContainer" index="4"] -margin_top = 730.0 -margin_right = 1600.0 -margin_bottom = 770.0 - -[node name="Button" parent="Menu/VBoxContainer" index="5"] -margin_left = 720.0 -margin_top = 774.0 -margin_right = 880.0 -margin_bottom = 822.0 +rect_min_size = Vector2( 1600, 900 ) [node name="Gameplay" parent="." instance=ExtResource( 2 )] visible = false @@ -355,9 +313,9 @@ custom_colors/font_outline_modulate = Color( 0, 0, 0, 1 ) margin_top = 538.0 margin_bottom = 568.0 -[connection signal="color_changed" from="Menu/VBoxContainer/Colors/Left Player/ColorPicker" to="." method="_on_LeftColorPicker_color_changed"] -[connection signal="color_changed" from="Menu/VBoxContainer/Colors/Right Player/ColorPicker" to="." method="_on_RightColorPicker_color_changed"] -[connection signal="button_up" from="Menu/VBoxContainer/Button" to="." method="_on_Button_button_up"] +[connection signal="color_changed" from="Menu/HContainer/VContainer/Colors/Left Player/ColorPicker" to="." method="_on_LeftColorPicker_color_changed"] +[connection signal="color_changed" from="Menu/HContainer/VContainer/Colors/Right Player/ColorPicker" to="." method="_on_RightColorPicker_color_changed"] +[connection signal="button_up" from="Menu/HContainer/VContainer/Button" to="." method="_on_Button_button_up"] [connection signal="timeout" from="Gameplay/Timer" to="." method="_on_PlayTimer_timeout"] [connection signal="animation_finished" from="Transitions/MenuTransition/Fade" to="." method="_on_MenuFade_animation_finished"] [connection signal="animation_finished" from="Transitions/LeftTransition/Fade" to="." method="_on_SideFade_animation_finished"] diff --git a/src/scenes/Gameplay.tscn b/src/scenes/Gameplay.tscn index 4392eac..9b6664b 100644 --- a/src/scenes/Gameplay.tscn +++ b/src/scenes/Gameplay.tscn @@ -17,6 +17,9 @@ self_modulate = Color( 1, 0.701961, 0.701961, 1 ) position = Vector2( 400, 450 ) player = "p1" +[node name="Label" parent="LeftPlayArea" index="0"] +self_modulate = Color( 1, 0.7, 0.7, 1 ) + [node name="Tiles" parent="LeftPlayArea" index="1"] visible = true self_modulate = Color( 1, 0.701961, 0.701961, 1 ) @@ -26,6 +29,9 @@ self_modulate = Color( 0.701961, 0.701961, 1, 1 ) position = Vector2( 1200, 450 ) player = "p2" +[node name="Label" parent="RightPlayArea" index="0"] +self_modulate = Color( 0.7, 0.7, 1, 1 ) + [node name="Tiles" parent="RightPlayArea" index="1"] visible = true self_modulate = Color( 0.701961, 0.701961, 1, 1 ) diff --git a/src/scenes/Menu.tscn b/src/scenes/Menu.tscn index e437ae7..3217997 100644 --- a/src/scenes/Menu.tscn +++ b/src/scenes/Menu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://src/fonts/Xolonium-Bold.ttf" type="DynamicFontData" id=1] [ext_resource path="res://src/fonts/Xolonium-Regular.ttf" type="DynamicFontData" id=2] @@ -10,6 +10,9 @@ font_data = ExtResource( 2 ) [sub_resource type="Theme" id=2] default_font = SubResource( 1 ) +[sub_resource type="DynamicFont" id=4] +font_data = ExtResource( 2 ) + [sub_resource type="DynamicFont" id=3] size = 48 font_data = ExtResource( 1 ) @@ -17,54 +20,69 @@ font_data = ExtResource( 1 ) [node name="Menu" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 -margin_right = 1600.0 -margin_bottom = 900.0 theme = SubResource( 2 ) -[node name="VBoxContainer" type="VBoxContainer" parent="."] +[node name="HContainer" type="HBoxContainer" parent="."] anchor_right = 1.0 anchor_bottom = 1.0 alignment = 1 -[node name="Title" type="Label" parent="VBoxContainer"] -margin_top = 528.0 -margin_right = 3200.0 -margin_bottom = 586.0 +[node name="VContainer" type="VBoxContainer" parent="HContainer"] +margin_left = 304.0 +margin_right = 1296.0 +margin_bottom = 900.0 + +[node name="Credits" type="Label" parent="HContainer/VContainer"] +margin_right = 992.0 +margin_bottom = 20.0 +custom_fonts/font = SubResource( 4 ) +text = "LD51 Compo entry - @Steffo" +align = 1 + +[node name="Padding3" type="HBoxContainer" parent="HContainer/VContainer"] +margin_top = 24.0 +margin_right = 992.0 +margin_bottom = 68.0 +rect_min_size = Vector2( 0, 44 ) + +[node name="Title" type="Label" parent="HContainer/VContainer"] +margin_top = 72.0 +margin_right = 992.0 +margin_bottom = 130.0 custom_fonts/font = SubResource( 3 ) text = "Particle Clash" align = 1 -[node name="Title2" type="Label" parent="VBoxContainer"] -margin_top = 590.0 -margin_right = 3200.0 -margin_bottom = 620.0 +[node name="Action" type="Label" parent="HContainer/VContainer"] +margin_top = 134.0 +margin_right = 992.0 +margin_bottom = 164.0 text = "Pick your (preferably light) colors!" align = 1 -[node name="Padding" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 624.0 -margin_right = 3200.0 -margin_bottom = 664.0 +[node name="Padding" type="HBoxContainer" parent="HContainer/VContainer"] +margin_top = 168.0 +margin_right = 992.0 +margin_bottom = 208.0 rect_min_size = Vector2( 0, 40 ) -[node name="Colors" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 668.0 -margin_right = 3200.0 -margin_bottom = 1176.0 +[node name="Colors" type="HBoxContainer" parent="HContainer/VContainer"] +margin_top = 212.0 +margin_right = 992.0 +margin_bottom = 720.0 alignment = 1 -[node name="Left Player" type="VBoxContainer" parent="VBoxContainer/Colors"] -margin_left = 1104.0 -margin_right = 1524.0 +[node name="Left Player" type="VBoxContainer" parent="HContainer/VContainer/Colors"] +margin_right = 420.0 margin_bottom = 508.0 alignment = 1 -[node name="Label" type="Label" parent="VBoxContainer/Colors/Left Player"] +[node name="Label" type="Label" parent="HContainer/VContainer/Colors/Left Player"] margin_right = 420.0 margin_bottom = 30.0 text = "Left Player [WASD + Space]" -[node name="ColorPicker" type="ColorPicker" parent="VBoxContainer/Colors/Left Player"] +[node name="ColorPicker" type="ColorPicker" parent="HContainer/VContainer/Colors/Left Player"] margin_top = 34.0 margin_right = 420.0 margin_bottom = 508.0 @@ -74,14 +92,14 @@ hsv_mode = true presets_enabled = false presets_visible = false -[node name="Vs" type="VBoxContainer" parent="VBoxContainer/Colors"] -margin_left = 1528.0 -margin_right = 1672.0 +[node name="Vs" type="VBoxContainer" parent="HContainer/VContainer/Colors"] +margin_left = 424.0 +margin_right = 568.0 margin_bottom = 508.0 rect_min_size = Vector2( 144, 0 ) alignment = 1 -[node name="Label" type="Label" parent="VBoxContainer/Colors/Vs"] +[node name="Label" type="Label" parent="HContainer/VContainer/Colors/Vs"] margin_top = 239.0 margin_right = 144.0 margin_bottom = 269.0 @@ -89,19 +107,19 @@ text = "VS" align = 1 valign = 1 -[node name="Right Player" type="VBoxContainer" parent="VBoxContainer/Colors"] -margin_left = 1676.0 -margin_right = 2096.0 +[node name="Right Player" type="VBoxContainer" parent="HContainer/VContainer/Colors"] +margin_left = 572.0 +margin_right = 992.0 margin_bottom = 508.0 alignment = 1 -[node name="Label" type="Label" parent="VBoxContainer/Colors/Right Player"] +[node name="Label" type="Label" parent="HContainer/VContainer/Colors/Right Player"] margin_right = 420.0 margin_bottom = 30.0 text = "[↑←↓→ + Enter] Right Player" align = 2 -[node name="ColorPicker" type="ColorPicker" parent="VBoxContainer/Colors/Right Player"] +[node name="ColorPicker" type="ColorPicker" parent="HContainer/VContainer/Colors/Right Player"] margin_top = 34.0 margin_right = 420.0 margin_bottom = 508.0 @@ -111,17 +129,17 @@ hsv_mode = true presets_enabled = false presets_visible = false -[node name="Padding2" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 1180.0 -margin_right = 3200.0 -margin_bottom = 1220.0 +[node name="Padding2" type="HBoxContainer" parent="HContainer/VContainer"] +margin_top = 724.0 +margin_right = 992.0 +margin_bottom = 764.0 rect_min_size = Vector2( 0, 40 ) -[node name="Button" type="Button" parent="VBoxContainer"] -margin_left = 1520.0 -margin_top = 1224.0 -margin_right = 1680.0 -margin_bottom = 1272.0 +[node name="Button" type="Button" parent="HContainer/VContainer"] +margin_left = 416.0 +margin_top = 768.0 +margin_right = 576.0 +margin_bottom = 816.0 rect_min_size = Vector2( 160, 48 ) size_flags_horizontal = 4 text = "Start!" diff --git a/src/scenes/Play Area.gd b/src/scenes/Play Area.gd index aa48717..3ada00c 100644 --- a/src/scenes/Play Area.gd +++ b/src/scenes/Play Area.gd @@ -19,19 +19,18 @@ func set_cursor_pos(val): ) cursor_pos = val -func cursor_would_collide(top_left: Vector2): +func cursor_would_collide(dest: Vector2): var shape = $Tiles.shape - var size_x = len(shape) - 1 - var size_y = len(shape[0]) - 1 + var size = len(shape) return \ - top_left.x < 0 || \ - top_left.y < 0 || \ - top_left.x >= size_x || \ - top_left.y >= size_y || \ - shape[top_left.x][top_left.y] == " " || \ - shape[top_left.x+1][top_left.y] == " " || \ - shape[top_left.x][top_left.y+1] == " " || \ - shape[top_left.x+1][top_left.y+1] == " " + dest.x < 0 || \ + dest.y < 0 || \ + dest.x > size - 2 || \ + dest.y > size - 2 || \ + shape[dest.y][dest.x] == " " || \ + shape[dest.y+1][dest.x] == " " || \ + shape[dest.y][dest.x+1] == " " || \ + shape[dest.y+1][dest.x+1] == " " func cursor_init(): var shape = $Tiles.shape