diff --git a/prefab/role/Role.tscn b/prefab/role/Role.tscn index 1bafcc1..cfaf82e 100644 --- a/prefab/role/Role.tscn +++ b/prefab/role/Role.tscn @@ -20,22 +20,6 @@ atlas = ExtResource( 3 ) region = Rect2( 48, 24, 16, 24 ) -[sub_resource type="AtlasTexture" id=25] -atlas = ExtResource( 3 ) -region = Rect2( 48, 48, 16, 24 ) - -[sub_resource type="AtlasTexture" id=26] -atlas = ExtResource( 3 ) -region = Rect2( 32, 48, 16, 24 ) - -[sub_resource type="AtlasTexture" id=27] -atlas = ExtResource( 3 ) -region = Rect2( 16, 48, 16, 24 ) - -[sub_resource type="AtlasTexture" id=28] -atlas = ExtResource( 3 ) -region = Rect2( 0, 48, 16, 24 ) - [sub_resource type="AtlasTexture" id=21] atlas = ExtResource( 3 ) region = Rect2( 0, 48, 16, 24 ) @@ -52,6 +36,22 @@ atlas = ExtResource( 3 ) region = Rect2( 48, 48, 16, 24 ) +[sub_resource type="AtlasTexture" id=25] +atlas = ExtResource( 3 ) +region = Rect2( 48, 48, 16, 24 ) + +[sub_resource type="AtlasTexture" id=26] +atlas = ExtResource( 3 ) +region = Rect2( 32, 48, 16, 24 ) + +[sub_resource type="AtlasTexture" id=27] +atlas = ExtResource( 3 ) +region = Rect2( 16, 48, 16, 24 ) + +[sub_resource type="AtlasTexture" id=28] +atlas = ExtResource( 3 ) +region = Rect2( 0, 48, 16, 24 ) + [sub_resource type="SpriteFrames" id=6] animations = [ { "frames": [ SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ) ], @@ -59,15 +59,15 @@ "name": "idle", "speed": 7.0 }, { -"frames": [ SubResource( 25 ), SubResource( 26 ), SubResource( 27 ), SubResource( 28 ) ], -"loop": true, -"name": "reverseRun", -"speed": 10.0 -}, { "frames": [ SubResource( 21 ), SubResource( 22 ), SubResource( 23 ), SubResource( 24 ) ], "loop": true, "name": "run", "speed": 10.0 +}, { +"frames": [ SubResource( 25 ), SubResource( 26 ), SubResource( 27 ), SubResource( 28 ) ], +"loop": true, +"name": "reverseRun", +"speed": 10.0 } ] [sub_resource type="RectangleShape2D" id=29] diff --git a/resource/sprite/package/craftpix-net-248911/16x16.png b/resource/sprite/package/craftpix-net-248911/16x16.png new file mode 100644 index 0000000..25987fc --- /dev/null +++ b/resource/sprite/package/craftpix-net-248911/16x16.png Binary files differ diff --git a/resource/sprite/package/craftpix-net-248911/16x16.png.import b/resource/sprite/package/craftpix-net-248911/16x16.png.import new file mode 100644 index 0000000..ee4ed50 --- /dev/null +++ b/resource/sprite/package/craftpix-net-248911/16x16.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/16x16.png-1fce0fa4d4d93e884e1588749849d671.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/package/craftpix-net-248911/16x16.png" +dest_files=[ "res://.import/16x16.png-1fce0fa4d4d93e884e1588749849d671.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/scene/TestNavigation.tscn b/scene/TestNavigation.tscn index ce5638b..7a12f1f 100644 --- a/scene/TestNavigation.tscn +++ b/scene/TestNavigation.tscn @@ -2,7 +2,7 @@ [ext_resource path="res://src/TestNavigation.cs" type="Script" id=1] [ext_resource path="res://icon.png" type="Texture" id=2] -[ext_resource path="res://resource/sprite/package/craftpix-net-248911/All Tileset/16x16.png" type="Texture" id=3] +[ext_resource path="res://resource/sprite/package/craftpix-net-248911/16x16.png" type="Texture" id=3] [sub_resource type="NavigationPolygon" id=2] vertices = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) diff --git a/src/role/Role.cs b/src/role/Role.cs index 8a4450c..335ba00 100644 --- a/src/role/Role.cs +++ b/src/role/Role.cs @@ -60,7 +60,7 @@ private FaceDirection _face; private Vector2 StartScele; - private Gun InteractiveItem = null; + private readonly List InteractiveItemList = new List(); public override void _Ready() { @@ -134,7 +134,7 @@ /// public bool HasTnteractive() { - return InteractiveItem != null; + return InteractiveItemList.Count > 0; } /// @@ -144,7 +144,8 @@ { if (HasTnteractive()) { - InteractiveItem.Tnteractive(this); + var item = InteractiveItemList[InteractiveItemList.Count - 1]; + item.Tnteractive(this); } } @@ -215,8 +216,10 @@ { if (other is Gun gun) { - InteractiveItem = gun; - GD.Print("enter"); + if (!InteractiveItemList.Contains(gun)) + { + InteractiveItemList.Add(gun); + } } } @@ -225,10 +228,12 @@ /// private void _OnPropsExit(Area2D other) { - if (other == InteractiveItem) + if (other is Gun gun) { - InteractiveItem = null; - GD.Print("exit"); + if (InteractiveItemList.Contains(gun)) + { + InteractiveItemList.Remove(gun); + } } }