diff --git a/Main.tscn b/Main.tscn index 05c12af..eb266b5 100644 --- a/Main.tscn +++ b/Main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=79 format=2] +[gd_scene load_steps=83 format=2] [ext_resource path="res://res/level/neighbor.png" type="Texture" id=1] [ext_resource path="res://res/character/girl.png" type="Texture" id=2] @@ -7,287 +7,295 @@ [ext_resource path="res://entity/KinematicBody2D.gd" type="Script" id=5] [ext_resource path="res://entity/Girl.gd" type="Script" id=6] [ext_resource path="res://entity/AI/Player.gd" type="Script" id=7] +[ext_resource path="res://entity/Marsh.gd" type="Script" id=8] +[ext_resource path="res://entity/NPC.gd" type="Script" id=9] -[sub_resource type="RectangleShape2D" id=24] +[sub_resource type="RectangleShape2D" id=1] extents = Vector2( 63.6867, 3.6744 ) -[sub_resource type="RectangleShape2D" id=25] +[sub_resource type="RectangleShape2D" id=2] extents = Vector2( 32.0662, 3.6744 ) -[sub_resource type="RectangleShape2D" id=33] +[sub_resource type="RectangleShape2D" id=3] extents = Vector2( 37.8145, 3.6744 ) -[sub_resource type="RectangleShape2D" id=34] +[sub_resource type="RectangleShape2D" id=4] extents = Vector2( 8.02289, 30.0256 ) -[sub_resource type="RectangleShape2D" id=46] +[sub_resource type="RectangleShape2D" id=5] extents = Vector2( 8.02289, 108.577 ) -[sub_resource type="RectangleShape2D" id=35] +[sub_resource type="RectangleShape2D" id=6] extents = Vector2( 8.02289, 293.961 ) -[sub_resource type="RectangleShape2D" id=74] +[sub_resource type="RectangleShape2D" id=7] extents = Vector2( 20.3464, 583.982 ) -[sub_resource type="RectangleShape2D" id=47] +[sub_resource type="RectangleShape2D" id=8] extents = Vector2( 8.02289, 30.9752 ) -[sub_resource type="RectangleShape2D" id=48] +[sub_resource type="RectangleShape2D" id=9] extents = Vector2( 8.02289, 98.1562 ) -[sub_resource type="RectangleShape2D" id=60] +[sub_resource type="RectangleShape2D" id=10] extents = Vector2( 8.02289, 67.4859 ) -[sub_resource type="RectangleShape2D" id=49] +[sub_resource type="RectangleShape2D" id=11] extents = Vector2( 8.02289, 74.0901 ) -[sub_resource type="RectangleShape2D" id=50] +[sub_resource type="RectangleShape2D" id=12] extents = Vector2( 8.02289, 35.0995 ) -[sub_resource type="RectangleShape2D" id=45] +[sub_resource type="RectangleShape2D" id=13] extents = Vector2( 8.02289, 444.485 ) -[sub_resource type="RectangleShape2D" id=36] +[sub_resource type="RectangleShape2D" id=14] extents = Vector2( 8.02289, 63.4933 ) -[sub_resource type="RectangleShape2D" id=37] +[sub_resource type="RectangleShape2D" id=15] extents = Vector2( 8.02289, 76.8 ) -[sub_resource type="RectangleShape2D" id=38] +[sub_resource type="RectangleShape2D" id=16] extents = Vector2( 68.1425, 3.6744 ) -[sub_resource type="RectangleShape2D" id=51] +[sub_resource type="RectangleShape2D" id=17] extents = Vector2( 38.0133, 3.6744 ) -[sub_resource type="RectangleShape2D" id=39] +[sub_resource type="RectangleShape2D" id=18] extents = Vector2( 68.4766, 3.6744 ) -[sub_resource type="RectangleShape2D" id=40] +[sub_resource type="RectangleShape2D" id=19] extents = Vector2( 40.3452, 3.6744 ) -[sub_resource type="RectangleShape2D" id=41] +[sub_resource type="RectangleShape2D" id=20] extents = Vector2( 29.019, 6.21887 ) -[sub_resource type="RectangleShape2D" id=52] +[sub_resource type="RectangleShape2D" id=21] extents = Vector2( 71.2418, 6.21887 ) -[sub_resource type="RectangleShape2D" id=53] +[sub_resource type="RectangleShape2D" id=22] extents = Vector2( 39.3086, 6.21887 ) -[sub_resource type="RectangleShape2D" id=54] +[sub_resource type="RectangleShape2D" id=23] extents = Vector2( 60.4154, 6.21887 ) -[sub_resource type="RectangleShape2D" id=61] -extents = Vector2( 129.855, 6.21887 ) +[sub_resource type="RectangleShape2D" id=24] +extents = Vector2( 86.5344, 6.21887 ) -[sub_resource type="RectangleShape2D" id=75] +[sub_resource type="RectangleShape2D" id=25] extents = Vector2( 341.619, 24.2664 ) -[sub_resource type="RectangleShape2D" id=62] +[sub_resource type="RectangleShape2D" id=26] extents = Vector2( 34.9545, 6.21887 ) -[sub_resource type="RectangleShape2D" id=63] +[sub_resource type="RectangleShape2D" id=27] extents = Vector2( 26.561, 6.21887 ) -[sub_resource type="RectangleShape2D" id=42] +[sub_resource type="RectangleShape2D" id=28] extents = Vector2( 284.625, 6.21887 ) -[sub_resource type="RectangleShape2D" id=43] +[sub_resource type="RectangleShape2D" id=29] extents = Vector2( 57.5036, 6.21887 ) -[sub_resource type="RectangleShape2D" id=44] +[sub_resource type="RectangleShape2D" id=30] extents = Vector2( 15.5976, 3.6744 ) -[sub_resource type="RectangleShape2D" id=68] +[sub_resource type="RectangleShape2D" id=31] extents = Vector2( 24.1026, 6.5618 ) -[sub_resource type="RectangleShape2D" id=69] +[sub_resource type="RectangleShape2D" id=32] extents = Vector2( 24.1026, 8.75928 ) -[sub_resource type="RectangleShape2D" id=28] +[sub_resource type="RectangleShape2D" id=33] extents = Vector2( 10.3047, 8.88223 ) -[sub_resource type="RectangleShape2D" id=29] +[sub_resource type="RectangleShape2D" id=34] extents = Vector2( 10.3047, 6.35382 ) -[sub_resource type="RectangleShape2D" id=70] +[sub_resource type="RectangleShape2D" id=35] extents = Vector2( 8.11879, 3.02176 ) -[sub_resource type="RectangleShape2D" id=30] +[sub_resource type="RectangleShape2D" id=36] extents = Vector2( 16.1447, 3.35818 ) -[sub_resource type="RectangleShape2D" id=71] +[sub_resource type="RectangleShape2D" id=37] extents = Vector2( 16.1447, 5.77868 ) -[sub_resource type="RectangleShape2D" id=72] +[sub_resource type="RectangleShape2D" id=38] extents = Vector2( 19.9137, 21.6313 ) -[sub_resource type="RectangleShape2D" id=55] +[sub_resource type="RectangleShape2D" id=39] extents = Vector2( 12.3065, 3.35818 ) -[sub_resource type="RectangleShape2D" id=56] +[sub_resource type="RectangleShape2D" id=40] extents = Vector2( 12.3065, 6.64336 ) -[sub_resource type="RectangleShape2D" id=57] +[sub_resource type="RectangleShape2D" id=41] extents = Vector2( 10.4873, 39.2022 ) -[sub_resource type="RectangleShape2D" id=31] +[sub_resource type="RectangleShape2D" id=42] extents = Vector2( 12.9732, 3.6744 ) -[sub_resource type="RectangleShape2D" id=58] +[sub_resource type="RectangleShape2D" id=43] extents = Vector2( 4.03589, 71.057 ) -[sub_resource type="RectangleShape2D" id=64] +[sub_resource type="RectangleShape2D" id=44] extents = Vector2( 4.03589, 37.6688 ) -[sub_resource type="RectangleShape2D" id=67] +[sub_resource type="RectangleShape2D" id=45] extents = Vector2( 4.03589, 33.133 ) -[sub_resource type="RectangleShape2D" id=65] +[sub_resource type="RectangleShape2D" id=46] extents = Vector2( 4.03589, 67.6024 ) -[sub_resource type="RectangleShape2D" id=66] +[sub_resource type="RectangleShape2D" id=47] extents = Vector2( 4.03589, 162.649 ) -[sub_resource type="RectangleShape2D" id=59] +[sub_resource type="RectangleShape2D" id=48] extents = Vector2( 74.0407, 3.6744 ) -[sub_resource type="AtlasTexture" id=1] +[sub_resource type="AtlasTexture" id=49] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 99, 0, 33, 50 ) +region = Rect2( 0, 0, 33, 50 ) -[sub_resource type="AtlasTexture" id=2] +[sub_resource type="AtlasTexture" id=50] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 99, 50, 33, 50 ) +region = Rect2( 0, 50, 33, 50 ) -[sub_resource type="AtlasTexture" id=3] +[sub_resource type="AtlasTexture" id=51] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 99, 100, 33, 50 ) +region = Rect2( 0, 100, 33, 50 ) -[sub_resource type="AtlasTexture" id=4] +[sub_resource type="AtlasTexture" id=52] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 99, 150, 33, 50 ) +region = Rect2( 0, 150, 33, 50 ) -[sub_resource type="AtlasTexture" id=5] +[sub_resource type="AtlasTexture" id=53] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 99, 200, 33, 50 ) +region = Rect2( 0, 200, 33, 50 ) -[sub_resource type="AtlasTexture" id=6] +[sub_resource type="AtlasTexture" id=54] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 33, 0, 33, 50 ) +region = Rect2( 0, 0, 33, 50 ) -[sub_resource type="AtlasTexture" id=7] +[sub_resource type="AtlasTexture" id=55] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 33, 50, 33, 50 ) +region = Rect2( 66, 0, 33, 50 ) -[sub_resource type="AtlasTexture" id=8] +[sub_resource type="AtlasTexture" id=56] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 33, 100, 33, 50 ) +region = Rect2( 66, 50, 33, 50 ) -[sub_resource type="AtlasTexture" id=9] +[sub_resource type="AtlasTexture" id=57] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 33, 150, 33, 50 ) +region = Rect2( 66, 100, 33, 50 ) -[sub_resource type="AtlasTexture" id=10] +[sub_resource type="AtlasTexture" id=58] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 33, 200, 33, 50 ) +region = Rect2( 66, 150, 33, 50 ) -[sub_resource type="AtlasTexture" id=11] +[sub_resource type="AtlasTexture" id=59] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 66, 0, 33, 50 ) +region = Rect2( 66, 200, 33, 50 ) -[sub_resource type="AtlasTexture" id=12] +[sub_resource type="AtlasTexture" id=60] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 66, 50, 33, 50 ) +region = Rect2( 99, 0, 33, 50 ) -[sub_resource type="AtlasTexture" id=13] +[sub_resource type="AtlasTexture" id=61] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 66, 100, 33, 50 ) +region = Rect2( 99, 50, 33, 50 ) -[sub_resource type="AtlasTexture" id=14] +[sub_resource type="AtlasTexture" id=62] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 66, 150, 33, 50 ) +region = Rect2( 99, 100, 33, 50 ) -[sub_resource type="AtlasTexture" id=15] +[sub_resource type="AtlasTexture" id=63] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 66, 200, 33, 50 ) +region = Rect2( 99, 150, 33, 50 ) -[sub_resource type="AtlasTexture" id=16] +[sub_resource type="AtlasTexture" id=64] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 0, 0, 33, 50 ) +region = Rect2( 99, 200, 33, 50 ) -[sub_resource type="AtlasTexture" id=17] +[sub_resource type="AtlasTexture" id=65] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 0, 50, 33, 50 ) +region = Rect2( 33, 0, 33, 50 ) -[sub_resource type="AtlasTexture" id=18] +[sub_resource type="AtlasTexture" id=66] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 0, 100, 33, 50 ) +region = Rect2( 33, 50, 33, 50 ) -[sub_resource type="AtlasTexture" id=19] +[sub_resource type="AtlasTexture" id=67] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 0, 150, 33, 50 ) +region = Rect2( 33, 100, 33, 50 ) -[sub_resource type="AtlasTexture" id=20] +[sub_resource type="AtlasTexture" id=68] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 0, 200, 33, 50 ) +region = Rect2( 33, 150, 33, 50 ) -[sub_resource type="AtlasTexture" id=23] +[sub_resource type="AtlasTexture" id=69] flags = 4 atlas = ExtResource( 2 ) -region = Rect2( 0, 0, 33, 50 ) +region = Rect2( 33, 200, 33, 50 ) -[sub_resource type="SpriteFrames" id=21] +[sub_resource type="SpriteFrames" id=70] animations = [ { -"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ], +"frames": [ SubResource( 49 ), SubResource( 50 ), SubResource( 51 ), SubResource( 52 ), SubResource( 53 ) ], "loop": true, -"name": "WalkRight", +"name": "WalkDown", "speed": 10.0 }, { -"frames": [ SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ) ], +"frames": [ SubResource( 54 ) ], "loop": true, -"name": "WalkLeft", -"speed": 10.0 +"name": "Idle", +"speed": 5.0 }, { -"frames": [ SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ) ], +"frames": [ SubResource( 55 ), SubResource( 56 ), SubResource( 57 ), SubResource( 58 ), SubResource( 59 ) ], "loop": true, "name": "WalkUp", "speed": 10.0 }, { -"frames": [ SubResource( 16 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ) ], +"frames": [ SubResource( 60 ), SubResource( 61 ), SubResource( 62 ), SubResource( 63 ), SubResource( 64 ) ], "loop": true, -"name": "WalkDown", +"name": "WalkRight", "speed": 10.0 }, { -"frames": [ SubResource( 23 ) ], +"frames": [ SubResource( 65 ), SubResource( 66 ), SubResource( 67 ), SubResource( 68 ), SubResource( 69 ) ], "loop": true, -"name": "Idle", -"speed": 5.0 +"name": "WalkLeft", +"speed": 10.0 } ] -[sub_resource type="RectangleShape2D" id=73] +[sub_resource type="RectangleShape2D" id=71] extents = Vector2( 7.40962, 1.04021 ) +[sub_resource type="CircleShape2D" id=72] +radius = 27.4372 + +[sub_resource type="RectangleShape2D" id=73] +extents = Vector2( 4.49039, 2.85052 ) + [node name="Node" type="Node"] [node name="World" type="Node2D" parent="."] @@ -302,236 +310,238 @@ __meta__ = { [node name="CollisionShape2D2" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 143.329, 237.348 ) -shape = SubResource( 24 ) +shape = SubResource( 1 ) [node name="CollisionShape2D8" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 32.535, 301.568 ) -shape = SubResource( 25 ) +shape = SubResource( 2 ) [node name="CollisionShape2D9" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 103.759, 364.845 ) -shape = SubResource( 33 ) +shape = SubResource( 3 ) [node name="CollisionShape2D11" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 72.0283, 392.309 ) -shape = SubResource( 34 ) +shape = SubResource( 4 ) [node name="CollisionShape2D12" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 199.786, 473.006 ) -shape = SubResource( 46 ) +shape = SubResource( 5 ) [node name="CollisionShape2D22" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 264.062, -250.781 ) -shape = SubResource( 35 ) +shape = SubResource( 6 ) [node name="CollisionShape2D54" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 339.664, -4.98611 ) -shape = SubResource( 74 ) +shape = SubResource( 7 ) [node name="CollisionShape2D55" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -336.336, 3.01389 ) -shape = SubResource( 74 ) +shape = SubResource( 7 ) [node name="CollisionShape2D29" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 135.722, 10.1415 ) -shape = SubResource( 47 ) +shape = SubResource( 8 ) [node name="CollisionShape2D30" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -120.363, 8.70917 ) -shape = SubResource( 48 ) +shape = SubResource( 9 ) [node name="CollisionShape2D39" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -247.719, 162.66 ) -shape = SubResource( 60 ) +shape = SubResource( 10 ) [node name="CollisionShape2D33" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -184.36, -25.9392 ) -shape = SubResource( 49 ) +shape = SubResource( 11 ) [node name="CollisionShape2D35" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -247.967, 6.94128 ) -shape = SubResource( 50 ) +shape = SubResource( 12 ) [node name="CollisionShape2D24" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -312.286, -144.661 ) -shape = SubResource( 45 ) +shape = SubResource( 13 ) [node name="CollisionShape2D13" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -248.515, 514.109 ) -shape = SubResource( 36 ) +shape = SubResource( 14 ) [node name="CollisionShape2D14" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -311.583, 505.7 ) -shape = SubResource( 37 ) +shape = SubResource( 15 ) [node name="CollisionShape2D10" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 252.03, 364.099 ) -shape = SubResource( 38 ) +shape = SubResource( 16 ) [node name="CollisionShape2D15" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 45.4571, 165.13 ) -shape = SubResource( 51 ) +shape = SubResource( 17 ) [node name="CollisionShape2D16" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -244.037, 301.104 ) -shape = SubResource( 39 ) +shape = SubResource( 18 ) [node name="CollisionShape2D17" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -280.493, 431.027 ) -shape = SubResource( 40 ) +shape = SubResource( 19 ) [node name="CollisionShape2D19" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -281.829, 482.368 ) -shape = SubResource( 41 ) +shape = SubResource( 20 ) [node name="CollisionShape2D31" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -183.471, 101.043 ) -shape = SubResource( 52 ) +shape = SubResource( 21 ) [node name="CollisionShape2D32" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -151.624, -93.6176 ) -shape = SubResource( 53 ) +shape = SubResource( 22 ) [node name="CollisionShape2D34" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -216.825, 41.9985 ) -shape = SubResource( 53 ) +shape = SubResource( 22 ) [node name="CollisionShape2D36" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -248.069, -26.9444 ) -shape = SubResource( 54 ) +shape = SubResource( 23 ) [node name="CollisionShape2D37" type="CollisionShape2D" parent="World/Level/StaticBody2D"] -position = Vector2( 13.9138, -22.7017 ) -shape = SubResource( 61 ) +position = Vector2( -29.9763, -22.2298 ) +shape = SubResource( 24 ) [node name="CollisionShape2D56" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 9.91382, -596.702 ) -shape = SubResource( 75 ) +shape = SubResource( 25 ) [node name="CollisionShape2D57" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 11.9138, 599.298 ) -shape = SubResource( 75 ) +shape = SubResource( 25 ) [node name="CollisionShape2D38" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -274.846, 231.538 ) -shape = SubResource( 62 ) +shape = SubResource( 26 ) [node name="CollisionShape2D40" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -280.519, 134.095 ) -shape = SubResource( 63 ) +shape = SubResource( 27 ) [node name="CollisionShape2D20" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -22.8132, 553.339 ) -shape = SubResource( 42 ) +shape = SubResource( 28 ) [node name="CollisionShape2D23" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -21.3526, -532.319 ) -shape = SubResource( 42 ) +shape = SubResource( 28 ) [node name="CollisionShape2D21" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 263.88, 553.708 ) -shape = SubResource( 43 ) +shape = SubResource( 29 ) [node name="CollisionShape2D18" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -183.805, 431.261 ) -shape = SubResource( 44 ) +shape = SubResource( 30 ) [node name="CollisionShape2D4" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 160.118, 247.028 ) -shape = SubResource( 68 ) +shape = SubResource( 31 ) [node name="CollisionShape2D52" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 224.187, 53.5974 ) -shape = SubResource( 69 ) +shape = SubResource( 32 ) [node name="CollisionShape2D5" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 179.69, 275.496 ) -shape = SubResource( 28 ) +shape = SubResource( 33 ) [node name="CollisionShape2D50" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 147.591, 107.333 ) -shape = SubResource( 28 ) +shape = SubResource( 33 ) [node name="CollisionShape2D45" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -300.1, 363.242 ) -shape = SubResource( 28 ) +shape = SubResource( 33 ) [node name="CollisionShape2D6" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 147.851, 269.69 ) -shape = SubResource( 29 ) +shape = SubResource( 34 ) [node name="CollisionShape2D49" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -44.106, 356.071 ) -shape = SubResource( 70 ) +shape = SubResource( 35 ) [node name="CollisionShape2D7" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 103.944, 244.217 ) -shape = SubResource( 30 ) +shape = SubResource( 36 ) [node name="CollisionShape2D51" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 167.943, 49.624 ) -shape = SubResource( 71 ) +shape = SubResource( 37 ) [node name="CollisionShape2D53" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 27.8719, 18.4961 ) -shape = SubResource( 72 ) +shape = SubResource( 38 ) [node name="CollisionShape2D46" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -280.471, 307.809 ) -shape = SubResource( 30 ) +shape = SubResource( 36 ) [node name="CollisionShape2D25" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 67.9435, 181.467 ) -shape = SubResource( 55 ) +shape = SubResource( 39 ) [node name="CollisionShape2D26" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 35.5376, 174.777 ) -shape = SubResource( 56 ) +shape = SubResource( 40 ) [node name="CollisionShape2D27" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 13.957, 206.569 ) -shape = SubResource( 57 ) +shape = SubResource( 41 ) [node name="CollisionShape2D3" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 261.277, 237.027 ) -shape = SubResource( 31 ) +shape = SubResource( 42 ) [node name="CollisionShape2D28" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 131.998, 110.734 ) -shape = SubResource( 58 ) +shape = SubResource( 43 ) [node name="CollisionShape2D42" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 84.053, 199.419 ) -shape = SubResource( 64 ) +shape = SubResource( 44 ) [node name="CollisionShape2D44" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 68.0144, 331.03 ) -shape = SubResource( 67 ) +shape = SubResource( 45 ) [node name="CollisionShape2D43" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 3.8119, 230.836 ) -shape = SubResource( 65 ) +shape = SubResource( 46 ) [node name="CollisionShape2D47" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -315.828, 363.341 ) -shape = SubResource( 65 ) +shape = SubResource( 46 ) [node name="CollisionShape2D48" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( -171.982, 365.025 ) -shape = SubResource( 65 ) +shape = SubResource( 46 ) [node name="CollisionShape2D41" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 275.084, 200.328 ) -shape = SubResource( 66 ) +shape = SubResource( 47 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="World/Level/StaticBody2D"] position = Vector2( 204.182, 41.4701 ) -shape = SubResource( 59 ) +shape = SubResource( 48 ) [node name="Enter" type="Position2D" parent="World"] position = Vector2( 208.579, 63.3655 ) -[node name="Girl" type="Node" parent="World/Enter"] +[node name="Girl" type="Node" parent="World/Enter" groups=[ +"player", +]] script = ExtResource( 6 ) [node name="KinematicBody2D" type="KinematicBody2D" parent="World/Enter/Girl"] @@ -539,32 +549,48 @@ position = Vector2( 208.579, 63.3655 ) script = ExtResource( 5 ) [node name="AnimatedSprite" type="AnimatedSprite" parent="World/Enter/Girl/KinematicBody2D"] -frames = SubResource( 21 ) +frames = SubResource( 70 ) animation = "Idle" -[node name="CollisionShape2D" type="CollisionShape2D" parent="World/Enter/Girl/KinematicBody2D"] +[node name="Feet" type="CollisionShape2D" parent="World/Enter/Girl/KinematicBody2D"] position = Vector2( 2.68069, 14.3499 ) -shape = SubResource( 73 ) +shape = SubResource( 71 ) [node name="Camera2D" type="Camera2D" parent="World/Enter/Girl/KinematicBody2D"] current = true +[node name="PersonalSpace" type="Area2D" parent="World/Enter/Girl/KinematicBody2D"] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="World/Enter/Girl/KinematicBody2D/PersonalSpace"] +position = Vector2( 1.70442, -0.164558 ) +shape = SubResource( 72 ) + [node name="AI" type="Node" parent="World/Enter/Girl"] script = ExtResource( 7 ) [node name="SpawnNPC" type="Position2D" parent="World"] -__meta__ = { -"_edit_lock_": true -} +position = Vector2( 99.5096, 278.601 ) + +[node name="Marsh" type="Node" parent="World/SpawnNPC" groups=[ +"can_interact", +]] +script = ExtResource( 8 ) + +[node name="StaticBody2D" type="StaticBody2D" parent="World/SpawnNPC/Marsh"] +position = Vector2( 99.5096, 278.601 ) +script = ExtResource( 9 ) -[node name="NPC" type="Sprite" parent="World/SpawnNPC"] +[node name="Sprite" type="Sprite" parent="World/SpawnNPC/Marsh/StaticBody2D" groups=[ +"can_interact", +]] texture = ExtResource( 3 ) region_enabled = true region_rect = Rect2( 7, 4, 34, 38 ) region_filter_clip = true -__meta__ = { -"_edit_lock_": true -} + +[node name="Feet" type="CollisionShape2D" parent="World/SpawnNPC/Marsh/StaticBody2D"] +position = Vector2( -1.125, 12.625 ) +shape = SubResource( 73 ) [node name="SpawnEnemy" type="Position2D" parent="World"] __meta__ = { diff --git a/entity/AI/Player.gd b/entity/AI/Player.gd index ddd2ba7..e7ff4c9 100644 --- a/entity/AI/Player.gd +++ b/entity/AI/Player.gd @@ -2,8 +2,11 @@ extends Node # Player AI var ignore_input = false +var body_exit_signal = false # interact_input() +var interact_target = null var velocity_sum = Vector2(0.0,0.0) +# Setters + Getters func set_ignore_input(new_bool): ignore_input = new_bool func get_ignore_input(): @@ -11,10 +14,55 @@ func get_ignore_input(): func get_user(): return get_parent() +### LOGIC ### + # Get Player Input func get_input(): if not ignore_input: get_movement_input() + get_interact_input() + +### INTERACTING ### + +# Listen for Hotkey for Interacting +func get_interact_input(): +## Interact Hotkey + if Input.is_action_just_pressed('interact'): +## Get overlapping bodies from range bubble + var bodies = get_user().get_overlapping_bodies() + #var areas = get_user().get_overlapping_areas() +## Exclusions + for body in bodies: + if !body.has_method("get_user"): + bodies.erase(body) + if body.has_method("get_user") and body.get_user().is_player(): + bodies.erase(body) + #for area in areas: + # if area.has_method("get_user"): + # areas.erase(area) +## Collect Interactable Targets in Range + var interact_targets = [] + for b in bodies: + if b.get_user().is_in_group("can_interact"): + interact_targets.append(b.get_user()) + #for a in areas: + # if a.get_user().is_in_group("can_interact"): + # interact_targets.append(a.get_user()) +## Find Nearest Interactable Target + if interact_targets: + interact_targets.sort_custom(FoeSorter.new(get_user().get_gpos()), "sort") + #get_user().set_target(interact_targets[0]) + interact_targets[0].interact() + +# Foe Finder System +class FoeSorter: + var point = null + func _init(new_point): + self.point = new_point + func sort(a, b): + return self.point.distance_to(a.get_gpos()) < self.point.distance_to(b.get_gpos()) + +### MOVEMENT ### # Get Movement Key Input func get_movement_input(): @@ -65,6 +113,8 @@ func movement_key_released(direction): get_user().animate("Idle") get_user().set_internal_velocity(velocity_sum) +### PHYSICS PROCESS + # Physics Process func _physics_process(_delta): ## Keyboard Movement diff --git a/entity/Girl.gd b/entity/Girl.gd index 0eee16b..7fc92cc 100644 --- a/entity/Girl.gd +++ b/entity/Girl.gd @@ -5,6 +5,8 @@ func get_body_node(): return $KinematicBody2D func get_sprite_node(): return $KinematicBody2D/AnimatedSprite +func is_player(): + return true ## Parameters func set_gpos(new_pos): @@ -13,6 +15,10 @@ func get_gpos(): return get_body_node().get_gpos() func set_internal_velocity(new_vel): get_body_node().set_internal_velocity(new_vel) +func get_overlapping_areas(): + return get_body_node().get_overlapping_areas() +func get_overlapping_bodies(): + return get_body_node().get_overlapping_bodies() ## Logic func animate(animation): diff --git a/entity/KinematicBody2D.gd b/entity/KinematicBody2D.gd index b8f9f21..2563abc 100644 --- a/entity/KinematicBody2D.gd +++ b/entity/KinematicBody2D.gd @@ -35,6 +35,10 @@ func get_internal_velocity(): if not get_can_move(): return Vector2(0.0,0.0) return internal_velocity +func get_overlapping_areas(): + return $PersonalSpace.get_overlapping_areas() +func get_overlapping_bodies(): + return $PersonalSpace.get_overlapping_bodies() func get_speed(): if !get_can_move(): return 0 diff --git a/entity/Marsh.gd b/entity/Marsh.gd new file mode 100644 index 0000000..3193c6b --- /dev/null +++ b/entity/Marsh.gd @@ -0,0 +1,10 @@ +extends Node + +func get_user(): + return get_parent() + +func is_player(): + return false + +func interact(): + print_debug("HI") diff --git a/entity/NPC.gd b/entity/NPC.gd new file mode 100644 index 0000000..ab6c3fe --- /dev/null +++ b/entity/NPC.gd @@ -0,0 +1,7 @@ +extends StaticBody2D + +func get_user(): + return get_parent() + +func interact(): + print_debug("HI") diff --git a/project.godot b/project.godot index 9e59f24..f1f6ff4 100644 --- a/project.godot +++ b/project.godot @@ -58,6 +58,11 @@ ui_down={ , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null) ] } +interact={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"unicode":0,"echo":false,"script":null) + ] +} [rendering]