diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2016-04-02 12:35:23 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2016-04-02 14:39:08 +0200 |
commit | 23cf6a85bdb904a1833c6015222d9ee69842c1ed (patch) | |
tree | f363b1cf1b6c9deb0549b071514dfc1ee7d5f093 /demos/2d/dynamic_collision_shapes | |
parent | 4eb49cc73241e0597174c4bfdfdddaf96dce86af (diff) |
Port 2D demos to TSCN/TRES formats
Part of #4196.
Diffstat (limited to 'demos/2d/dynamic_collision_shapes')
-rw-r--r-- | demos/2d/dynamic_collision_shapes/ball.scn | bin | 1857 -> 0 bytes | |||
-rw-r--r-- | demos/2d/dynamic_collision_shapes/ball.tscn | 47 | ||||
-rw-r--r-- | demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd | 2 | ||||
-rw-r--r-- | demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn | bin | 4399 -> 0 bytes | |||
-rw-r--r-- | demos/2d/dynamic_collision_shapes/dynamic_colobjs.tscn | 178 | ||||
-rw-r--r-- | demos/2d/dynamic_collision_shapes/engine.cfg | 2 |
6 files changed, 227 insertions, 2 deletions
diff --git a/demos/2d/dynamic_collision_shapes/ball.scn b/demos/2d/dynamic_collision_shapes/ball.scn Binary files differdeleted file mode 100644 index 51a91d5bc0..0000000000 --- a/demos/2d/dynamic_collision_shapes/ball.scn +++ /dev/null diff --git a/demos/2d/dynamic_collision_shapes/ball.tscn b/demos/2d/dynamic_collision_shapes/ball.tscn new file mode 100644 index 0000000000..31560e251b --- /dev/null +++ b/demos/2d/dynamic_collision_shapes/ball.tscn @@ -0,0 +1,47 @@ +[gd_scene load_steps=4 format=1] + +[ext_resource path="res://ball.gd" type="Script" id=1] +[ext_resource path="res://ball.png" type="Texture" id=2] + +[sub_resource type="CircleShape2D" id=1] + +custom_solver_bias = 0.0 +radius = 7.45713 + +[node name="bal" type="RigidBody2D"] + +input/pickable = false +shapes/0/shape = SubResource( 1 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +shapes/0/trigger = false +collision/layers = 1 +collision/mask = 1 +mode = 0 +mass = 1.0 +friction = 1.0 +bounce = 0.0 +gravity_scale = 1.0 +custom_integrator = false +continuous_cd = 0 +contacts_reported = 0 +contact_monitor = false +sleeping = false +can_sleep = true +velocity/linear = Vector2( 0, 0 ) +velocity/angular = 0.0 +damp_override/linear = -1.0 +damp_override/angular = -1.0 +script/script = ExtResource( 1 ) + +[node name="sprite" type="Sprite" parent="."] + +transform/pos = Vector2( 0, 1 ) +texture = ExtResource( 2 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] + +shape = SubResource( 1 ) +trigger = false +_update_shape_index = 0 + + diff --git a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd index 25db51642b..c43b82a722 100644 --- a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd +++ b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.gd @@ -10,7 +10,7 @@ func _process(delta): timeout -= delta if (timeout < 0): timeout = EMIT_INTERVAL - var ball = preload("res://ball.scn").instance() + var ball = preload("res://ball.tscn").instance() ball.set_pos(Vector2(randf()*get_viewport_rect().size.x, 0)) add_child(ball) diff --git a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn Binary files differdeleted file mode 100644 index 6d17e2209f..0000000000 --- a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.scn +++ /dev/null diff --git a/demos/2d/dynamic_collision_shapes/dynamic_colobjs.tscn b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.tscn new file mode 100644 index 0000000000..61af0b8e7d --- /dev/null +++ b/demos/2d/dynamic_collision_shapes/dynamic_colobjs.tscn @@ -0,0 +1,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 + + diff --git a/demos/2d/dynamic_collision_shapes/engine.cfg b/demos/2d/dynamic_collision_shapes/engine.cfg index 76a074f346..b1feb20408 100644 --- a/demos/2d/dynamic_collision_shapes/engine.cfg +++ b/demos/2d/dynamic_collision_shapes/engine.cfg @@ -1,5 +1,5 @@ [application] name="Run-Time CollisionShape" -main_scene="res://dynamic_colobjs.scn" +main_scene="res://dynamic_colobjs.tscn" icon="res://icon.png" |