pong.tscn 3.4 KB

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