summaryrefslogtreecommitdiff
path: root/demos/2d/dynamic_collision_shapes/dynamic_colobjs.tscn
blob: 61af0b8e7daa4100d54d161fc7d64ba6c8e03144 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
[gd_scene load_steps=13 format=1]

[ext_resource path="res://dynamic_colobjs.gd" type="Script" id=1]
[ext_resource path="res://circle.png" type="Texture" id=2]
[ext_resource path="res://box.png" type="Texture" id=3]
[ext_resource path="res://poly.png" type="Texture" id=4]

[sub_resource type="CircleShape2D" id=1]

custom_solver_bias = 0.0
radius = 28.8504

[sub_resource type="RectangleShape2D" id=2]

custom_solver_bias = 0.0
extents = Vector2( 32.1805, 30.0328 )

[sub_resource type="ConvexPolygonShape2D" id=3]

custom_solver_bias = 0.0
points = Vector2Array( 49.5669, -27.9744, 45.1564, 15.3961, 18.6931, -1.51105 )

[sub_resource type="ConvexPolygonShape2D" id=4]

custom_solver_bias = 0.0
points = Vector2Array( -55.093, -14.2052, -37.1739, 2.89948, -40.1345, 21.2602, -53.3067, 15.8716 )

[sub_resource type="ConvexPolygonShape2D" id=5]

custom_solver_bias = 0.0
points = Vector2Array( -40.1345, 21.2602, -37.1739, 2.89948, -14.386, -14.0076, -6.30005, 0.694214 )

[sub_resource type="ConvexPolygonShape2D" id=6]

custom_solver_bias = 0.0
points = Vector2Array( -14.386, -14.0076, 18.6931, -1.51105, 45.1564, 15.3961, -6.30005, 0.694214 )

[sub_resource type="Animation" id=7]

resource/name = "movethem"
length = 4.0
loop = true
step = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath("base/circle:transform/pos")
tracks/0/interp = 1
tracks/0/keys = { "cont":true, "times":FloatArray( 0, 2 ), "transitions":FloatArray( 1, 1 ), "values":[ Vector2( 0, 0 ), Vector2( 52.7569, -70.845 ) ] }
tracks/1/type = "value"
tracks/1/path = NodePath("base/box:transform/pos")
tracks/1/interp = 1
tracks/1/keys = { "cont":true, "times":FloatArray( 0, 2 ), "transitions":FloatArray( 1, 1 ), "values":[ Vector2( 193.173, -2.72076 ), Vector2( 195.894, -72.0999 ) ] }
tracks/2/type = "value"
tracks/2/path = NodePath("base/box:transform/rot")
tracks/2/interp = 1
tracks/2/keys = { "cont":true, "times":FloatArray( 0, 2 ), "transitions":FloatArray( 1, 1 ), "values":[ 0.0, 92.8111 ] }
tracks/3/type = "value"
tracks/3/path = NodePath("base/polygon:transform/pos")
tracks/3/interp = 1
tracks/3/keys = { "cont":true, "times":FloatArray( 0, 2 ), "transitions":FloatArray( 1, 1 ), "values":[ Vector2( 382.265, -2.72076 ), Vector2( 495.176, -10.883 ) ] }

[sub_resource type="Animation" id=8]

resource/name = "toggletrigger"
length = 6.0
loop = true
step = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath("base/box:trigger")
tracks/0/interp = 1
tracks/0/keys = { "cont":false, "times":FloatArray( 0, 4 ), "transitions":FloatArray( 1, 1 ), "values":[ false, true ] }
tracks/1/type = "value"
tracks/1/path = NodePath("base/box:visibility/opacity")
tracks/1/interp = 1
tracks/1/keys = { "cont":false, "times":FloatArray( 0, 4 ), "transitions":FloatArray( 1, 1 ), "values":[ 1.0, 0.2 ] }

[node name="base" type="Node2D"]

script/script = ExtResource( 1 )

[node name="base" type="KinematicBody2D" parent="."]

transform/pos = Vector2( 137, 470 )
input/pickable = false
shapes/0/shape = SubResource( 1 )
shapes/0/transform = Matrix32( 1, 0, 0, 1, 7.91353, -10.6267 )
shapes/0/trigger = false
shapes/1/shape = SubResource( 2 )
shapes/1/transform = Matrix32( 0.970626, -0.240595, 0.240595, 0.970626, 193.581, -13.1276 )
shapes/1/trigger = false
shapes/2/shape = SubResource( 3 )
shapes/2/transform = Matrix32( 1, 0, 0, 1, 399.202, -3.9451 )
shapes/2/trigger = false
shapes/3/shape = SubResource( 4 )
shapes/3/transform = Matrix32( 1, 0, 0, 1, 399.202, -3.9451 )
shapes/3/trigger = false
shapes/4/shape = SubResource( 5 )
shapes/4/transform = Matrix32( 1, 0, 0, 1, 399.202, -3.9451 )
shapes/4/trigger = false
shapes/5/shape = SubResource( 6 )
shapes/5/transform = Matrix32( 1, 0, 0, 1, 399.202, -3.9451 )
shapes/5/trigger = false
collision/layers = 1
collision/mask = 1
collision/margin = 0.08

[node name="circle" type="CollisionShape2D" parent="base"]

transform/pos = Vector2( 7.91353, -10.6267 )
shape = SubResource( 1 )
trigger = false
_update_shape_index = 0

[node name="sprite" type="Sprite" parent="base/circle"]

texture = ExtResource( 2 )

[node name="box" type="CollisionShape2D" parent="base"]

transform/pos = Vector2( 193.581, -13.1276 )
transform/rot = 13.9217
shape = SubResource( 2 )
trigger = false
_update_shape_index = 1

[node name="Sprite" type="Sprite" parent="base/box"]

texture = ExtResource( 3 )

[node name="polygon" type="CollisionPolygon2D" parent="base"]

transform/pos = Vector2( 399.202, -3.9451 )
build_mode = 0
polygon = Vector2Array( -55.093, -14.2052, -37.1739, 2.89948, -14.386, -14.0076, 18.6931, -1.51105, 49.5669, -27.9744, 45.1564, 15.3961, -6.30005, 0.694214, -40.1345, 21.2602, -53.3067, 15.8716 )
shape_range = Vector2( 2, 5 )
trigger = false

[node name="Sprite" type="Sprite" parent="base/polygon"]

texture = ExtResource( 4 )

[node name="shapemove" type="AnimationPlayer" parent="."]

playback/process_mode = 1
playback/default_blend_time = 0.0
root/root = NodePath("..")
anims/movethem = SubResource( 7 )
playback/active = true
playback/speed = 1.0
blend_times = [  ]
autoplay = "movethem"

[node name="triggertoggle" type="AnimationPlayer" parent="."]

playback/process_mode = 1
playback/default_blend_time = 0.0
root/root = NodePath("..")
anims/movethem = SubResource( 7 )
anims/toggletrigger = SubResource( 8 )
playback/active = true
playback/speed = 1.0
blend_times = [  ]
autoplay = "toggletrigger"

[node name="Label" type="Label" parent="."]

focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
margin/left = 21.0
margin/top = 21.0
margin/right = 719.0
margin/bottom = 73.0
text = "This demo simply shows that it\'s possible now to move a CollisionShape and CollisionPolygon after it was created\nand also turn it into a trigger at run-time. CollisionShape will remain alive during the running game and you can\ninteract with them, even though they are just meant to be helpers.\nIt is always recommended in a real use-case scenario, to move a body instead of a shape, as that path is better optimized."
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1