From 70aa197568b7f877189720d0a0a4594e1612339d Mon Sep 17 00:00:00 2001 From: Just Dzhi Date: Sun, 1 Oct 2023 17:24:46 +0400 Subject: [PATCH] enemy animations --- src/models/enemies/bat/Bat.tscn | 15 +++++--- src/models/enemies/bat/bat.gd | 2 + src/models/enemies/bat/sprite.png | Bin 1867 -> 0 bytes src/models/enemies/bat/sprites/bat.png | Bin 0 -> 518 bytes .../bat.png.import} | 6 +-- .../enemies/bat/sprites/bat_spriteframes.tres | 27 ++++++++++++++ src/models/enemies/ghost/Ghost.tscn | 12 +++--- src/models/enemies/ghost/sprites/ghost.png | Bin 1902 -> 535 bytes .../ghost/sprites/ghost_spriteframes.tres | 31 ++++++++++++++++ src/models/enemies/trash_can/TrashCan.tscn | 12 +++--- .../enemies/trash_can/sprites/rolling.png | Bin 0 -> 905 bytes .../trash_can/sprites/rolling.png.import | 35 ++++++++++++++++++ .../sprites/trash_can_spriteframes.tres | 27 ++++++++++++++ 13 files changed, 148 insertions(+), 19 deletions(-) delete mode 100644 src/models/enemies/bat/sprite.png create mode 100644 src/models/enemies/bat/sprites/bat.png rename src/models/enemies/bat/{sprite.png.import => sprites/bat.png.import} (71%) create mode 100644 src/models/enemies/bat/sprites/bat_spriteframes.tres create mode 100644 src/models/enemies/ghost/sprites/ghost_spriteframes.tres create mode 100644 src/models/enemies/trash_can/sprites/rolling.png create mode 100644 src/models/enemies/trash_can/sprites/rolling.png.import create mode 100644 src/models/enemies/trash_can/sprites/trash_can_spriteframes.tres diff --git a/src/models/enemies/bat/Bat.tscn b/src/models/enemies/bat/Bat.tscn index e60b400..ff800ad 100644 --- a/src/models/enemies/bat/Bat.tscn +++ b/src/models/enemies/bat/Bat.tscn @@ -1,10 +1,10 @@ [gd_scene load_steps=5 format=2] -[ext_resource path="res://src/models/enemies/bat/sprite.png" type="Texture" id=1] +[ext_resource path="res://src/models/enemies/bat/sprites/bat_spriteframes.tres" type="SpriteFrames" id=1] [ext_resource path="res://src/models/enemies/bat/bat.gd" type="Script" id=2] [sub_resource type="RectangleShape2D" id=1] -extents = Vector2( 4, 3 ) +extents = Vector2( 3.5, 3 ) [sub_resource type="RectangleShape2D" id=2] extents = Vector2( 6, 4 ) @@ -14,17 +14,20 @@ collision_layer = 2 collision_mask = 2 script = ExtResource( 2 ) -[node name="Sprite" type="Sprite" parent="."] +[node name="Sprite" type="AnimatedSprite" parent="."] use_parent_material = true -texture = ExtResource( 1 ) +frames = ExtResource( 1 ) +animation = "idle" +frame = 3 +playing = true centered = false [node name="Area2D" type="Area2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] -position = Vector2( 7, 4 ) +position = Vector2( 8.5, 10 ) shape = SubResource( 1 ) [node name="SameSpeciesCollider" type="CollisionShape2D" parent="."] -position = Vector2( 7, 4 ) +position = Vector2( 8.5, 10 ) shape = SubResource( 2 ) diff --git a/src/models/enemies/bat/bat.gd b/src/models/enemies/bat/bat.gd index 9c7fbb3..96dc75e 100644 --- a/src/models/enemies/bat/bat.gd +++ b/src/models/enemies/bat/bat.gd @@ -25,5 +25,7 @@ func _physics_process(_delta): velocity.x = cos(angle + 180) velocity.y = sin(angle + 180) + self.global_position.y += sin(Time.get_ticks_msec() * 0.01) / 3 + velocity *= speed * speed_multiplier velocity = move_and_slide(velocity) diff --git a/src/models/enemies/bat/sprite.png b/src/models/enemies/bat/sprite.png deleted file mode 100644 index b30bf6145883f4a996535e972a755b5d34609647..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1867 zcmcIlO=uid9G_4KHBxKULkO)76A(q;&gagT+2(6w6U@YrtZq_0_~yMgyF+&7jWd(% zZlsrbQDY$ol@bd*6j2b05%p4N!H+|r6rp&iv=zY*@Sq1T;z4|~U#-%{TwIu)H@m<0 z`~TkW|C{$-pPxH+U|?u~W|+bT2$SJ1Ly;sX_M_CNA)hfqm#(G-fk|zz zA&7dkVbbx5IVLt>B+5A{TT>V4IJ-lGpodPE zb9w%;vL9kvPae+{btaG^Oi4jtT~mQ%0aYr=mMuxPtUMv9Y|w@}EC?8;aBpCWeXqF} zsN>i(VUofSk(pvaV4`xqk8R1-6j?JcfV!oFyrQ|lG7Sx=NXITwC1mLNmM%8GNYQHM zL^i*jTTBt-=(%aD$UvrLVxTCh4m4LYfvMs=@Kj5Z6$xR}g&nPWcl#}SRrB* zR2X~7X*|wnP8#wvwsKo_NKEhw28#s zE4H-Wwmo(yvpqK(_I7*r&^s?k$d($j)8P8=g>iP0oSrF;mj>SsHn$JGI(GlQ^26n^ zx#wP-I9PnhePD6l&f+&ee|PfC$RDS!&DMu+oWk$EGxcHLSJKe@S^L+<_0z}C|M^4n z$d}U1q4=${2d`{wJYT;0i1o(Ri+$#?zOm1iKUw!a*R6pQzig(}_f9-D`oZ_>hsoiM zt=V%&zG&QdLA?3?w!Y)MwzZ80Fa3CV_M>yh-}D~+_Urz>zqnUEeP;8gkJD?}aW^wH LS3E!Q(#gL8w=h{k diff --git a/src/models/enemies/bat/sprites/bat.png b/src/models/enemies/bat/sprites/bat.png new file mode 100644 index 0000000000000000000000000000000000000000..cb6f95f54a32e8e757928849ad2f68e0c35e06b3 GIT binary patch literal 518 zcmV+h0{Q)kP)Px$z)3_wR9J=WmP>MjFc3t0QaORMb}l7tI0N3`gTMyP;0;^~ukjT+3u`C=;^PG8 zQ&Cq@Wr6k7%#20=QBhG*|5x(U2G&Fpg;WF}8Pm=4uJ%TM{NB8Y^7fF(J#??T(4H>= zz(OiyOjnbBwKvwyWjy~W8U%2h9nHKo2?5BlJ_I3}jS$0Q0RXK@1i*xMwKo8O-t(CN zkTI1)Dil&tgBbGn+2B3uPc>VC&YUl9H4|W{sUXkaZdZGotdTL*7kt#;qTfCIEpB0J z5(N$9fU^~;=3LeE^FzFG#aNT@SRZ6ds^m@rwKXMhrvsoarzUy z;30Cx326G0NzOP8g6k=CdTr+UedUq!{kQX?qN1XrqN2V-AKAj$OV literal 0 HcmV?d00001 diff --git a/src/models/enemies/bat/sprite.png.import b/src/models/enemies/bat/sprites/bat.png.import similarity index 71% rename from src/models/enemies/bat/sprite.png.import rename to src/models/enemies/bat/sprites/bat.png.import index 2b84f0a..c348d5c 100644 --- a/src/models/enemies/bat/sprite.png.import +++ b/src/models/enemies/bat/sprites/bat.png.import @@ -2,15 +2,15 @@ importer="texture" type="StreamTexture" -path="res://.import/sprite.png-742176af9ae55b1874092f535d7f098a.stex" +path="res://.import/bat.png-fb52342f0135bec2219869dda59a68bd.stex" metadata={ "vram_texture": false } [deps] -source_file="res://src/models/enemies/bat/sprite.png" -dest_files=[ "res://.import/sprite.png-742176af9ae55b1874092f535d7f098a.stex" ] +source_file="res://src/models/enemies/bat/sprites/bat.png" +dest_files=[ "res://.import/bat.png-fb52342f0135bec2219869dda59a68bd.stex" ] [params] diff --git a/src/models/enemies/bat/sprites/bat_spriteframes.tres b/src/models/enemies/bat/sprites/bat_spriteframes.tres new file mode 100644 index 0000000..2332270 --- /dev/null +++ b/src/models/enemies/bat/sprites/bat_spriteframes.tres @@ -0,0 +1,27 @@ +[gd_resource type="SpriteFrames" load_steps=6 format=2] + +[ext_resource path="res://src/models/enemies/bat/sprites/bat.png" type="Texture" id=1] + +[sub_resource type="AtlasTexture" id=1] +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 20, 20 ) + +[sub_resource type="AtlasTexture" id=2] +atlas = ExtResource( 1 ) +region = Rect2( 20, 0, 20, 20 ) + +[sub_resource type="AtlasTexture" id=3] +atlas = ExtResource( 1 ) +region = Rect2( 40, 0, 20, 20 ) + +[sub_resource type="AtlasTexture" id=4] +atlas = ExtResource( 1 ) +region = Rect2( 60, 0, 20, 20 ) + +[resource] +animations = [ { +"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ], +"loop": true, +"name": "idle", +"speed": 12.0 +} ] diff --git a/src/models/enemies/ghost/Ghost.tscn b/src/models/enemies/ghost/Ghost.tscn index 4773bf0..6d47d9f 100644 --- a/src/models/enemies/ghost/Ghost.tscn +++ b/src/models/enemies/ghost/Ghost.tscn @@ -1,22 +1,24 @@ [gd_scene load_steps=4 format=2] -[ext_resource path="res://src/models/enemies/ghost/sprites/ghost.png" type="Texture" id=1] +[ext_resource path="res://src/models/enemies/ghost/sprites/ghost_spriteframes.tres" type="SpriteFrames" id=1] [ext_resource path="res://src/models/enemies/ghost/ghost.gd" type="Script" id=2] [sub_resource type="RectangleShape2D" id=1] -extents = Vector2( 7, 9 ) +extents = Vector2( 5.5, 5.5 ) [node name="Ghost" type="KinematicBody2D" groups=["enemy"]] z_index = 2 script = ExtResource( 2 ) -[node name="Sprite" type="Sprite" parent="."] +[node name="Sprite" type="AnimatedSprite" parent="."] use_parent_material = true -texture = ExtResource( 1 ) +frames = ExtResource( 1 ) +animation = "idle" +playing = true centered = false [node name="Area2D" type="Area2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] -position = Vector2( 7, 9 ) +position = Vector2( 8.5, 13.5 ) shape = SubResource( 1 ) diff --git a/src/models/enemies/ghost/sprites/ghost.png b/src/models/enemies/ghost/sprites/ghost.png index 5a33c4fdf47413e98193522fb4af1526a272f6df..f59a329fedd71494e34c404ebe95f2ac54e98723 100644 GIT binary patch literal 535 zcmV+y0_gpTP)Px$(Md!>R9J=WmoavOFbsx&_jL!b7-&FIW@K|~h92tvwG z|L^5Rfb}8Ul5K#hs;YmauIo&{LwE6q?vmMDulzzj@@r8v}q=78Q=&bFyTN;M3@tSoiXLj%K> z4KMu@0_GA(jE`CglI!?|*g#696am1p8Cp0AVRkc|<51_f;1FX=j=Dx$)?;OZ+?8X| zo}5uevo-ijdBKV7gb+(JZ{;~Py! zmh~1b;gpt+J>q#5XZ9Qo0C@jc8dK#6O`W5=>-A@_@%_0rgv#k9Gnzh1PD)#Tf9@Pz zIYPyygB%;QrzyBam7^c;fbw_$=p%!CMG$5VP&}6XIcKYW%^vTdmr$IzUsB~%RaI53 Z*DrTjYz_Z*RGa_+002ovPDHLkV1kmA_w4`x literal 1902 zcmcI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y^7r&E^Nl|@z4!i@dF1oy!l~)k zyH0)7eR%ePJ=d!*_(#tVf4H)&eZ6?_>`w02d%`akE8kwb+;{Q1UfFki<>ij&-dP&o z-}%E=kNotKgaimhhh diff --git a/src/models/enemies/ghost/sprites/ghost_spriteframes.tres b/src/models/enemies/ghost/sprites/ghost_spriteframes.tres new file mode 100644 index 0000000..7b8d3ab --- /dev/null +++ b/src/models/enemies/ghost/sprites/ghost_spriteframes.tres @@ -0,0 +1,31 @@ +[gd_resource type="SpriteFrames" load_steps=7 format=2] + +[ext_resource path="res://src/models/enemies/ghost/sprites/ghost.png" type="Texture" id=1] + +[sub_resource type="AtlasTexture" id=1] +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 18, 22 ) + +[sub_resource type="AtlasTexture" id=2] +atlas = ExtResource( 1 ) +region = Rect2( 18, 0, 18, 22 ) + +[sub_resource type="AtlasTexture" id=3] +atlas = ExtResource( 1 ) +region = Rect2( 36, 0, 18, 22 ) + +[sub_resource type="AtlasTexture" id=4] +atlas = ExtResource( 1 ) +region = Rect2( 54, 0, 18, 22 ) + +[sub_resource type="AtlasTexture" id=5] +atlas = ExtResource( 1 ) +region = Rect2( 72, 0, 18, 22 ) + +[resource] +animations = [ { +"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ) ], +"loop": true, +"name": "idle", +"speed": 12.0 +} ] diff --git a/src/models/enemies/trash_can/TrashCan.tscn b/src/models/enemies/trash_can/TrashCan.tscn index c13bf15..fdec38a 100644 --- a/src/models/enemies/trash_can/TrashCan.tscn +++ b/src/models/enemies/trash_can/TrashCan.tscn @@ -1,21 +1,23 @@ [gd_scene load_steps=4 format=2] -[ext_resource path="res://src/models/enemies/trash_can/sprites/trash_can.png" type="Texture" id=1] +[ext_resource path="res://src/models/enemies/trash_can/sprites/trash_can_spriteframes.tres" type="SpriteFrames" id=1] [ext_resource path="res://src/models/enemies/trash_can/trash_can.gd" type="Script" id=2] [sub_resource type="RectangleShape2D" id=1] -extents = Vector2( 6, 7 ) +extents = Vector2( 5.5, 7 ) [node name="TrashCan" type="KinematicBody2D"] z_index = 2 script = ExtResource( 2 ) -[node name="Sprite" type="Sprite" parent="."] +[node name="Sprite" type="AnimatedSprite" parent="."] position = Vector2( 3, 0 ) -texture = ExtResource( 1 ) +frames = ExtResource( 1 ) +animation = "rolling" +playing = true [node name="EnemyCollider" type="Area2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="EnemyCollider"] -position = Vector2( 3, 0 ) +position = Vector2( 3.5, 5 ) shape = SubResource( 1 ) diff --git a/src/models/enemies/trash_can/sprites/rolling.png b/src/models/enemies/trash_can/sprites/rolling.png new file mode 100644 index 0000000000000000000000000000000000000000..62f58687d0ed89bda656b4380b9c968dbf7ee1ca GIT binary patch literal 905 zcmV;419tq0P)Px&LrFwIRA_If=F-wuEGBD6Y>eep&fDUFzoF+NP^(BQVk94}oabCavVt=3SfPsO5 zfq{X6fq{X6fq#vZviu}TA{k?{*_I?ptzXxV($Q(!_%rDyNmBF87?aJmF1n@|=vXlY zJIgY190x)ODTI)ma|wU|fOEd=yDQ(u9Q*m7Tbhn0$g+&Q-LFNkA^QYbx0;$0=zP~jJA0M-CH-kt$~oZnvMLAIoiUtNIfTd97n>$^0r>q6y49mm_V&My!4eyzu_ z^6Popd)gJe`|CRa!2H=u92^|f?v2M|q-l!rcw8p^E|_%taG$Q48#Xo{On3d`j%18! zU)W-iTYrbcn@dcu&j6S!r003n0%DC20$G-|>aNT_(fgYp+Ixm#BpG8wL`Ge8JsnLz zKfl=M-s@LNNxtt((o{L^DdO2to+B zjjdl5Z49t%iYWUVG<&1d4#N-#^DXbXF3_?|+O!OQ$@hKOtzbYEFO^@V=XvE;Xs~qt zEzD^5V=;z=`6O^3CcgmCt2l>Yh&YbRZvgOpA8o5xdy1$)K%RSADtxCD5k(P&VTjYy z(^`9xBFGdR3&`NNH&GOoIk=jB+E%dsr*efL2wGQD9LJpkTm;gn+p)+k<=3{z+4ybh fDU5&i4D{zOCOMN5l1*cQ00000NkvXXu0mjfWDB)c literal 0 HcmV?d00001 diff --git a/src/models/enemies/trash_can/sprites/rolling.png.import b/src/models/enemies/trash_can/sprites/rolling.png.import new file mode 100644 index 0000000..a3dbd4a --- /dev/null +++ b/src/models/enemies/trash_can/sprites/rolling.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/rolling.png-40d73114e6eb4a8c6a697e781597c9da.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://src/models/enemies/trash_can/sprites/rolling.png" +dest_files=[ "res://.import/rolling.png-40d73114e6eb4a8c6a697e781597c9da.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/src/models/enemies/trash_can/sprites/trash_can_spriteframes.tres b/src/models/enemies/trash_can/sprites/trash_can_spriteframes.tres new file mode 100644 index 0000000..37ff401 --- /dev/null +++ b/src/models/enemies/trash_can/sprites/trash_can_spriteframes.tres @@ -0,0 +1,27 @@ +[gd_resource type="SpriteFrames" load_steps=6 format=2] + +[ext_resource path="res://src/models/enemies/trash_can/sprites/rolling.png" type="Texture" id=1] + +[sub_resource type="AtlasTexture" id=1] +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 22, 24 ) + +[sub_resource type="AtlasTexture" id=2] +atlas = ExtResource( 1 ) +region = Rect2( 22, 0, 22, 24 ) + +[sub_resource type="AtlasTexture" id=3] +atlas = ExtResource( 1 ) +region = Rect2( 44, 0, 22, 24 ) + +[sub_resource type="AtlasTexture" id=4] +atlas = ExtResource( 1 ) +region = Rect2( 66, 0, 22, 24 ) + +[resource] +animations = [ { +"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ) ], +"loop": true, +"name": "rolling", +"speed": 16.0 +} ]