godot/demos/2d/dynamic_collision_shapes/dynamic_colobjs.tscn

179 lines
5.9 KiB
Plaintext
Raw Normal View History

[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