Implement basic peg and ball

This commit is contained in:
Steffo 2024-09-22 22:14:40 +02:00
parent cacb7bbe84
commit 79b8c1059e
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
3 changed files with 43 additions and 1 deletions

14
prefabs/ball.tscn Normal file
View file

@ -0,0 +1,14 @@
[gd_scene load_steps=3 format=3 uid="uid://ylvptuj0xnm8"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_1mhds"]
bounce = 0.92
[sub_resource type="CircleShape2D" id="CircleShape2D_xd6lq"]
radius = 24.0
[node name="Ball" type="RigidBody2D"]
physics_material_override = SubResource("PhysicsMaterial_1mhds")
[node name="Shape" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_xd6lq")
debug_color = Color(0.7, 0, 0, 0.419608)

10
prefabs/peg.tscn Normal file
View file

@ -0,0 +1,10 @@
[gd_scene load_steps=2 format=3 uid="uid://bbtm3534mdeat"]
[sub_resource type="CircleShape2D" id="CircleShape2D_cj4kg"]
radius = 24.0
[node name="Peg" type="StaticBody2D"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_cj4kg")
debug_color = Color(0.7, 0.7, 0.7, 0.419608)

View file

@ -1,3 +1,21 @@
[gd_scene format=3 uid="uid://d15wtjeqete7v"] [gd_scene load_steps=3 format=3 uid="uid://d15wtjeqete7v"]
[ext_resource type="PackedScene" uid="uid://ylvptuj0xnm8" path="res://prefabs/ball.tscn" id="1_d2cjj"]
[ext_resource type="PackedScene" uid="uid://bbtm3534mdeat" path="res://prefabs/peg.tscn" id="2_i427g"]
[node name="Root" type="Node2D"] [node name="Root" type="Node2D"]
[node name="Ball" parent="." instance=ExtResource("1_d2cjj")]
position = Vector2(42, -281)
[node name="Peg" parent="." instance=ExtResource("2_i427g")]
position = Vector2(77, -102)
[node name="Peg2" parent="." instance=ExtResource("2_i427g")]
position = Vector2(-68, -70)
[node name="Peg3" parent="." instance=ExtResource("2_i427g")]
position = Vector2(45, 77)
[node name="Peg4" parent="." instance=ExtResource("2_i427g")]
position = Vector2(-114, 125)