diff options
Diffstat (limited to 'demos/2d/area_input/input.tscn')
-rw-r--r-- | demos/2d/area_input/input.tscn | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/demos/2d/area_input/input.tscn b/demos/2d/area_input/input.tscn new file mode 100644 index 0000000000..81c0ed918d --- /dev/null +++ b/demos/2d/area_input/input.tscn @@ -0,0 +1,109 @@ +[gd_scene load_steps=6 format=1] + +[ext_resource path="res://input.gd" type="Script" id=1] +[ext_resource path="res://box_area.png" type="Texture" id=2] +[ext_resource path="res://circle_area.png" type="Texture" id=3] + +[sub_resource type="RectangleShape2D" id=1] + +custom_solver_bias = 0.0 +extents = Vector2( 64, 64 ) + +[sub_resource type="CircleShape2D" id=2] + +custom_solver_bias = 0.0 +radius = 64.0 + +[node name="base" type="Node2D"] + +[node name="box" type="Area2D" parent="."] + +transform/pos = Vector2( 212, 281 ) +transform/rot = 35.4081 +input/pickable = true +shapes/0/shape = SubResource( 1 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +shapes/0/trigger = false +gravity_vec = Vector2( 0, 1 ) +gravity = 98.0 +linear_damp = 0.1 +angular_damp = 1.0 +script/script = ExtResource( 1 ) + +[node name="sprite" type="Sprite" parent="box"] + +texture = ExtResource( 2 ) + +[node name="label" type="Label" parent="box"] + +focus/ignore_mouse = true +focus/stop_mouse = true +size_flags/horizontal = 2 +margin/left = -43.0 +margin/top = 71.0 +margin/right = 43.0 +margin/bottom = 84.0 +align = 1 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[node name="shape" type="CollisionShape2D" parent="box"] + +shape = SubResource( 1 ) +trigger = false +_update_shape_index = -1 + +[node name="circle" type="Area2D" parent="."] + +transform/pos = Vector2( 547.877, 286.808 ) +transform/rot = -40.5985 +input/pickable = true +shapes/0/shape = SubResource( 2 ) +shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 ) +shapes/0/trigger = false +gravity_vec = Vector2( 0, 1 ) +gravity = 98.0 +linear_damp = 0.1 +angular_damp = 1.0 +script/script = ExtResource( 1 ) + +[node name="sprite" type="Sprite" parent="circle"] + +texture = ExtResource( 3 ) + +[node name="label" type="Label" parent="circle"] + +focus/ignore_mouse = true +focus/stop_mouse = true +size_flags/horizontal = 2 +margin/left = -43.0 +margin/top = 71.0 +margin/right = 43.0 +margin/bottom = 84.0 +align = 1 +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + +[node name="shape" type="CollisionShape2D" parent="circle"] + +shape = SubResource( 2 ) +trigger = false +_update_shape_index = -1 + +[node name="Label" type="Label" parent="."] + +focus/ignore_mouse = true +focus/stop_mouse = true +size_flags/horizontal = 2 +margin/left = 0.0 +margin/top = 0.0 +margin/right = 40.0 +margin/bottom = 13.0 +text = "This demo shows how to use a regular Area2D to get input events, and how to convert the input events to local coordinates of the node.\nUnlike controls, Input on Area2D or PhysicsBody2D nodes only works properly (with scrolling) on canvas layer 0." +percent_visible = 1.0 +lines_skipped = 0 +max_lines_visible = -1 + + |