pong.tscn 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. [gd_scene load_steps=12 format=3 uid="uid://jlfslyfbhid5"]
  2. [ext_resource type="Script" path="res://logic/paddle.gd" id="1"]
  3. [ext_resource type="Texture2D" uid="uid://dvrb8efddt0aa" path="res://paddle.png" id="2"]
  4. [ext_resource type="Script" path="res://logic/ball.gd" id="4"]
  5. [ext_resource type="Texture2D" uid="uid://clowikjgl4yq1" path="res://ball.png" id="5"]
  6. [ext_resource type="Texture2D" uid="uid://drgpdyyomyqpl" path="res://separator.png" id="6"]
  7. [ext_resource type="Script" path="res://logic/wall.gd" id="7"]
  8. [ext_resource type="Script" path="res://logic/ceiling_floor.gd" id="8"]
  9. [sub_resource type="RectangleShape2D" id="1"]
  10. size = Vector2(8, 32)
  11. [sub_resource type="RectangleShape2D" id="2"]
  12. size = Vector2(8, 8)
  13. [sub_resource type="RectangleShape2D" id="3"]
  14. size = Vector2(20, 400)
  15. [sub_resource type="RectangleShape2D" id="4"]
  16. size = Vector2(640, 20)
  17. [node name="Pong" type="Node2D"]
  18. [node name="Background" type="ColorRect" parent="."]
  19. offset_right = 640.0
  20. offset_bottom = 400.0
  21. color = Color(0.141176, 0.152941, 0.164706, 1)
  22. [node name="Left" type="Area2D" parent="."]
  23. modulate = Color(0, 1, 1, 1)
  24. position = Vector2(67.6285, 192.594)
  25. script = ExtResource("1")
  26. [node name="Sprite2D" type="Sprite2D" parent="Left"]
  27. texture = ExtResource("2")
  28. [node name="Collision" type="CollisionShape2D" parent="Left"]
  29. shape = SubResource("1")
  30. [node name="Right" type="Area2D" parent="."]
  31. modulate = Color(1, 0, 1, 1)
  32. position = Vector2(563.815, 188.919)
  33. script = ExtResource("1")
  34. [node name="Sprite2D" type="Sprite2D" parent="Right"]
  35. texture = ExtResource("2")
  36. [node name="Collision" type="CollisionShape2D" parent="Right"]
  37. shape = SubResource("1")
  38. [node name="Ball" type="Area2D" parent="."]
  39. position = Vector2(320.5, 191.124)
  40. script = ExtResource("4")
  41. [node name="Sprite2D" type="Sprite2D" parent="Ball"]
  42. texture = ExtResource("5")
  43. [node name="Collision" type="CollisionShape2D" parent="Ball"]
  44. shape = SubResource("2")
  45. [node name="Separator" type="Sprite2D" parent="."]
  46. position = Vector2(320, 200)
  47. texture = ExtResource("6")
  48. [node name="LeftWall" type="Area2D" parent="."]
  49. position = Vector2(-10, 200)
  50. script = ExtResource("7")
  51. [node name="Collision" type="CollisionShape2D" parent="LeftWall"]
  52. shape = SubResource("3")
  53. [node name="RightWall" type="Area2D" parent="."]
  54. position = Vector2(650, 200)
  55. script = ExtResource("7")
  56. [node name="Collision" type="CollisionShape2D" parent="RightWall"]
  57. shape = SubResource("3")
  58. [node name="Ceiling" type="Area2D" parent="."]
  59. position = Vector2(320, -10)
  60. script = ExtResource("8")
  61. [node name="Collision" type="CollisionShape2D" parent="Ceiling"]
  62. shape = SubResource("4")
  63. [node name="Floor" type="Area2D" parent="."]
  64. position = Vector2(320, 410)
  65. script = ExtResource("8")
  66. _bounce_direction = -1
  67. [node name="Collision" type="CollisionShape2D" parent="Floor"]
  68. shape = SubResource("4")
  69. [node name="Camera2D" type="Camera2D" parent="."]
  70. offset = Vector2(320, 200)
  71. current = true
  72. [connection signal="area_entered" from="Left" to="Left" method="_on_area_entered"]
  73. [connection signal="area_entered" from="Right" to="Right" method="_on_area_entered"]
  74. [connection signal="area_entered" from="LeftWall" to="LeftWall" method="_on_wall_area_entered"]
  75. [connection signal="area_entered" from="RightWall" to="RightWall" method="_on_wall_area_entered"]
  76. [connection signal="area_entered" from="Ceiling" to="Ceiling" method="_on_area_entered"]
  77. [connection signal="area_entered" from="Floor" to="Floor" method="_on_area_entered"]