Finallized scoring logic and adjusted ball speed.

This commit is contained in:
Henry 2025-08-25 14:51:30 +01:00
parent 4eba01e61b
commit e5dc6dd42a
3 changed files with 48 additions and 4 deletions

View file

@ -57,17 +57,21 @@ shape = SubResource("RectangleShape2D_mwb40")
[node name="Polygon2D" type="Polygon2D" parent="BottomWall"]
polygon = PackedVector2Array(-30, -10, -30, 10, 1172, 10, 1172, -10)
[node name="Paddle-0" parent="." instance=ExtResource("1_80nbo")]
[node name="Paddle-0" parent="." node_paths=PackedStringArray("score_label") instance=ExtResource("1_80nbo")]
position = Vector2(40, 273)
score_label = NodePath("../HBoxContainer/Score-0")
[node name="Paddle-1" parent="." instance=ExtResource("1_80nbo")]
[node name="Paddle-1" parent="." node_paths=PackedStringArray("score_label") instance=ExtResource("1_80nbo")]
position = Vector2(1078, 273)
player_id = 1
score_label = NodePath("../HBoxContainer/Score-1")
[node name="Ball" type="CharacterBody2D" parent="."]
[node name="Ball" type="CharacterBody2D" parent="." node_paths=PackedStringArray("paddle_0", "paddle_1")]
position = Vector2(134, 72)
motion_mode = 1
script = ExtResource("2_e2o6t")
paddle_0 = NodePath("../Paddle-0")
paddle_1 = NodePath("../Paddle-1")
[node name="Polygon2D" type="Polygon2D" parent="Ball"]
polygon = PackedVector2Array(100, 75, 120, 75, 120, 95, 100, 95)
@ -79,4 +83,26 @@ shape = SubResource("RectangleShape2D_feb5d")
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="Ball"]
position = Vector2(110, 85)
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_top = 20.0
offset_bottom = 43.0
grow_horizontal = 2
[node name="Score-0" type="Label" parent="HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 40
text = "00"
horizontal_alignment = 1
[node name="Score-1" type="Label" parent="HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 40
text = "00"
horizontal_alignment = 1
[connection signal="screen_exited" from="Ball/VisibleOnScreenNotifier2D" to="Ball" method="_on_screen_exited"]