test_one_way_collision.tscn 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. [gd_scene load_steps=9 format=2]
  2. [ext_resource path="res://tests/functional/test_one_way_collision.gd" type="Script" id=1]
  3. [ext_resource path="res://icon.png" type="Texture" id=2]
  4. [ext_resource path="res://tests/test_options.tscn" type="PackedScene" id=3]
  5. [ext_resource path="res://utils/label_slider_value.gd" type="Script" id=4]
  6. [ext_resource path="res://utils/slider.gd" type="Script" id=5]
  7. [sub_resource type="RectangleShape2D" id=1]
  8. extents = Vector2( 32, 32 )
  9. [sub_resource type="RectangleShape2D" id=2]
  10. extents = Vector2( 64, 32 )
  11. [sub_resource type="RectangleShape2D" id=3]
  12. extents = Vector2( 32, 32 )
  13. [node name="Test" type="Node2D"]
  14. script = ExtResource( 1 )
  15. [node name="LabelTestType" type="Label" parent="."]
  16. margin_left = 14.0
  17. margin_top = 79.0
  18. margin_right = 145.0
  19. margin_bottom = 93.0
  20. text = "Testing: "
  21. __meta__ = {
  22. "_edit_use_anchors_": false
  23. }
  24. [node name="Options" parent="." instance=ExtResource( 3 )]
  25. [node name="Controls" type="VBoxContainer" parent="."]
  26. pause_mode = 2
  27. anchor_right = 1.0
  28. anchor_bottom = 1.0
  29. margin_left = 25.3619
  30. margin_top = 416.765
  31. margin_right = 265.362
  32. margin_bottom = 484.765
  33. custom_constants/separation = 10
  34. __meta__ = {
  35. "_edit_use_anchors_": false
  36. }
  37. [node name="PlatformSize" type="HBoxContainer" parent="Controls"]
  38. margin_right = 432.0
  39. margin_bottom = 16.0
  40. custom_constants/separation = 20
  41. alignment = 2
  42. __meta__ = {
  43. "_edit_use_anchors_": false
  44. }
  45. [node name="Label" type="Label" parent="Controls/PlatformSize"]
  46. margin_left = 8.0
  47. margin_top = 1.0
  48. margin_right = 92.0
  49. margin_bottom = 15.0
  50. text = "Platform size"
  51. [node name="HSlider" type="HSlider" parent="Controls/PlatformSize"]
  52. margin_left = 112.0
  53. margin_right = 312.0
  54. margin_bottom = 16.0
  55. rect_min_size = Vector2( 200, 0 )
  56. min_value = 32.0
  57. max_value = 128.0
  58. value = 64.0
  59. script = ExtResource( 5 )
  60. [node name="LabelValue" type="Label" parent="Controls/PlatformSize"]
  61. margin_left = 332.0
  62. margin_top = 1.0
  63. margin_right = 432.0
  64. margin_bottom = 15.0
  65. rect_min_size = Vector2( 100, 0 )
  66. text = "64.0"
  67. script = ExtResource( 4 )
  68. [node name="PlatformAngle" type="HBoxContainer" parent="Controls"]
  69. margin_top = 26.0
  70. margin_right = 432.0
  71. margin_bottom = 42.0
  72. custom_constants/separation = 20
  73. alignment = 2
  74. __meta__ = {
  75. "_edit_use_anchors_": false
  76. }
  77. [node name="Label" type="Label" parent="Controls/PlatformAngle"]
  78. margin_top = 1.0
  79. margin_right = 92.0
  80. margin_bottom = 15.0
  81. text = "Platform angle"
  82. [node name="HSlider" type="HSlider" parent="Controls/PlatformAngle"]
  83. margin_left = 112.0
  84. margin_right = 312.0
  85. margin_bottom = 16.0
  86. rect_min_size = Vector2( 200, 0 )
  87. max_value = 360.0
  88. script = ExtResource( 5 )
  89. snap_step = 5.0
  90. [node name="LabelValue" type="Label" parent="Controls/PlatformAngle"]
  91. margin_left = 332.0
  92. margin_top = 1.0
  93. margin_right = 432.0
  94. margin_bottom = 15.0
  95. rect_min_size = Vector2( 100, 0 )
  96. text = "0.0"
  97. script = ExtResource( 4 )
  98. [node name="BodyAngle" type="HBoxContainer" parent="Controls"]
  99. margin_top = 52.0
  100. margin_right = 432.0
  101. margin_bottom = 68.0
  102. custom_constants/separation = 20
  103. alignment = 2
  104. __meta__ = {
  105. "_edit_use_anchors_": false
  106. }
  107. [node name="Label" type="Label" parent="Controls/BodyAngle"]
  108. margin_left = 22.0
  109. margin_top = 1.0
  110. margin_right = 92.0
  111. margin_bottom = 15.0
  112. text = "Body angle"
  113. [node name="HSlider" type="HSlider" parent="Controls/BodyAngle"]
  114. margin_left = 112.0
  115. margin_right = 312.0
  116. margin_bottom = 16.0
  117. rect_min_size = Vector2( 200, 0 )
  118. max_value = 360.0
  119. script = ExtResource( 5 )
  120. snap_step = 5.0
  121. [node name="LabelValue" type="Label" parent="Controls/BodyAngle"]
  122. margin_left = 332.0
  123. margin_top = 1.0
  124. margin_right = 432.0
  125. margin_bottom = 15.0
  126. rect_min_size = Vector2( 100, 0 )
  127. text = "0.0"
  128. script = ExtResource( 4 )
  129. [node name="LabelResultTitle" type="Label" parent="."]
  130. anchor_left = 0.5
  131. anchor_top = 0.5
  132. anchor_right = 0.5
  133. anchor_bottom = 0.5
  134. margin_left = 34.1273
  135. margin_top = 251.131
  136. margin_right = 88.1273
  137. margin_bottom = 265.131
  138. text = "RESULT: "
  139. align = 1
  140. valign = 1
  141. __meta__ = {
  142. "_edit_use_anchors_": false
  143. }
  144. [node name="LabelResult" type="Label" parent="."]
  145. anchor_left = 0.5
  146. anchor_top = 0.5
  147. anchor_right = 0.5
  148. anchor_bottom = 0.5
  149. margin_left = 34.1273
  150. margin_top = 266.131
  151. margin_right = 88.1273
  152. margin_bottom = 280.131
  153. text = "..."
  154. align = 1
  155. valign = 1
  156. __meta__ = {
  157. "_edit_use_anchors_": false
  158. }
  159. [node name="LabelRestart" type="Label" parent="."]
  160. anchor_left = 0.5
  161. anchor_top = 0.5
  162. anchor_right = 0.5
  163. anchor_bottom = 0.5
  164. margin_left = 34.1273
  165. margin_top = 304.841
  166. margin_right = 139.127
  167. margin_bottom = 318.841
  168. text = "SPACE - RESTART"
  169. align = 1
  170. valign = 1
  171. __meta__ = {
  172. "_edit_use_anchors_": false
  173. }
  174. [node name="Timer" type="Timer" parent="."]
  175. wait_time = 5.0
  176. one_shot = true
  177. [node name="TargetArea2D" type="Area2D" parent="."]
  178. position = Vector2( 724, 300 )
  179. [node name="CollisionShape2D" type="CollisionShape2D" parent="TargetArea2D"]
  180. shape = SubResource( 1 )
  181. [node name="OneWayKinematicBody2D" type="KinematicBody2D" parent="."]
  182. position = Vector2( 512, 300 )
  183. [node name="CollisionShape2D" type="CollisionShape2D" parent="OneWayKinematicBody2D"]
  184. shape = SubResource( 2 )
  185. one_way_collision = true
  186. [node name="RigidBody2D" type="RigidBody2D" parent="."]
  187. position = Vector2( 300, 300 )
  188. collision_mask = 2147483649
  189. gravity_scale = 0.0
  190. contacts_reported = 1
  191. contact_monitor = true
  192. [node name="Sprite" type="Sprite" parent="RigidBody2D"]
  193. self_modulate = Color( 1, 1, 1, 0.501961 )
  194. scale = Vector2( 0.5, 0.5 )
  195. texture = ExtResource( 2 )
  196. [node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"]
  197. shape = SubResource( 3 )
  198. [node name="KinematicBody2D" type="KinematicBody2D" parent="."]
  199. position = Vector2( 300, 300 )
  200. collision_mask = 2147483649
  201. [node name="Sprite" type="Sprite" parent="KinematicBody2D"]
  202. self_modulate = Color( 1, 1, 1, 0.501961 )
  203. scale = Vector2( 0.5, 0.5 )
  204. texture = ExtResource( 2 )
  205. [node name="CollisionShape2D" type="CollisionShape2D" parent="KinematicBody2D"]
  206. shape = SubResource( 3 )
  207. [connection signal="value_changed" from="Controls/PlatformSize/HSlider" to="." method="_set_platform_size"]
  208. [connection signal="value_changed" from="Controls/PlatformAngle/HSlider" to="." method="_set_platform_angle"]
  209. [connection signal="value_changed" from="Controls/BodyAngle/HSlider" to="." method="_set_rigidbody_angle"]