ball now more consistently collides with arbitrary objects and bounces off them appropriately

This commit is contained in:
2024-07-23 20:07:13 +02:00
parent 3fea3c89ed
commit 091d957d26
7 changed files with 147 additions and 102 deletions
+41 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=4 format=3 uid="uid://sl3jbnopo0yh"]
[gd_scene load_steps=8 format=3 uid="uid://sl3jbnopo0yh"]
[ext_resource type="PackedScene" uid="uid://d2r0ip6xy3a2" path="res://balls/ball.tscn" id="1_ffml1"]
[ext_resource type="Texture2D" uid="uid://cxi0fqy5sajh5" path="res://balls/basic/basic.webp" id="2_4dnuc"]
@@ -6,10 +6,50 @@
[sub_resource type="RectangleShape2D" id="RectangleShape2D_isusp"]
size = Vector2(50, 50)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qicwc"]
size = Vector2(46, 2)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ugdte"]
size = Vector2(46, 2)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2tu06"]
size = Vector2(2, 46)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_0vqpn"]
size = Vector2(2, 46)
[node name="Ball" instance=ExtResource("1_ffml1")]
collision_mask = 14
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="0"]
shape = SubResource("RectangleShape2D_isusp")
[node name="Sprite2D" type="Sprite2D" parent="." index="1"]
texture = ExtResource("2_4dnuc")
[node name="Raycasts" type="Node2D" parent="." index="2"]
visible = false
[node name="North" type="ShapeCast2D" parent="Raycasts" index="0"]
shape = SubResource("RectangleShape2D_qicwc")
target_position = Vector2(0, -25)
collision_mask = 10
collide_with_areas = true
[node name="South" type="ShapeCast2D" parent="Raycasts" index="1"]
shape = SubResource("RectangleShape2D_ugdte")
target_position = Vector2(0, 25)
collision_mask = 10
collide_with_areas = true
[node name="West" type="ShapeCast2D" parent="Raycasts" index="2"]
shape = SubResource("RectangleShape2D_2tu06")
target_position = Vector2(-25, 0)
collision_mask = 10
collide_with_areas = true
[node name="East" type="ShapeCast2D" parent="Raycasts" index="3"]
shape = SubResource("RectangleShape2D_0vqpn")
target_position = Vector2(25, 0)
collision_mask = 10
collide_with_areas = true