From 3e60215e11231c19461e959f2cb73965cc037a26 Mon Sep 17 00:00:00 2001 From: Evgenij Titarenko Date: Mon, 21 Aug 2023 17:28:40 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B0=D0=BD=D0=B8=D0=BC=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D1=88=D0=B8=D0=BF=D0=BE=D0=B2,=20=D0=B0=20?= =?UTF-8?q?=D1=82=D0=B0=D0=BA=D0=B6=D0=B5=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=D1=85=20=D0=BB=D0=BE=D0=B3?= =?UTF-8?q?=D0=B8=D0=BA=D0=B8=20(=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=BF=D1=80=D0=B8=20=D0=B7=D0=B0=D0=BA=D1=80=D1=8B?= =?UTF-8?q?=D1=82=D0=B8=D0=B8,=20=D1=83=D0=B2=D0=B5=D0=BB=D0=B8=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=20=D0=B2=20=D1=83=D0=B1=D1=80=D0=B0=D0=BD=D0=BD=D0=BE?= =?UTF-8?q?=D0=BC=20=D1=81=D0=BE=D1=81=D1=82=D0=BE=D1=8F=D0=BD=D0=B8=D0=B8?= =?UTF-8?q?,=20=D1=83=D0=BC=D0=B5=D0=BD=D1=8C=D1=88=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BA=D0=BE=D0=BB=D0=BB=D0=B0=D0=B9=D0=B4=D0=B5=D1=80?= =?UTF-8?q?=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prefabs/entities/spikes.tscn | 4 +--- scripts/entities/Spikes.cs | 9 +++++---- sprites/tiles/floor/spikes/spikes.tres | 21 +++++++++++++-------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/prefabs/entities/spikes.tscn b/prefabs/entities/spikes.tscn index 6fbfe54..92c188f 100644 --- a/prefabs/entities/spikes.tscn +++ b/prefabs/entities/spikes.tscn @@ -4,7 +4,7 @@ [ext_resource type="SpriteFrames" uid="uid://uith5rxps4s" path="res://sprites/tiles/floor/spikes/spikes.tres" id="2_t76h0"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_guqiy"] -size = Vector2(32, 32) +size = Vector2(24, 24) [node name="spikes" type="Area2D"] z_index = -1 @@ -12,8 +12,6 @@ script = ExtResource("1_r27mb") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] sprite_frames = ExtResource("2_t76h0") -frame = 2 -frame_progress = 1.0 [node name="Sprite2D" type="Sprite2D" parent="AnimatedSprite2D"] diff --git a/scripts/entities/Spikes.cs b/scripts/entities/Spikes.cs index 8bb0e1b..08f9779 100644 --- a/scripts/entities/Spikes.cs +++ b/scripts/entities/Spikes.cs @@ -13,7 +13,7 @@ public partial class Spikes : Area2D } [Export] public bool Enabled = false; - [Export] public float SpikesTimeout = 1f; + [Export] public float SpikesTimeout = 2f; [Export] public float StartOffset = 0f; private AnimatedSprite2D _sprite; private State _state = State.Waiting; @@ -40,7 +40,7 @@ public partial class Spikes : Area2D switch (_state) { case State.Waiting: - _sprite.Stop(); + _sprite.Play("default"); _timeSinceState += (float)delta; if (_timeSinceState > SpikesTimeout) { @@ -49,11 +49,12 @@ public partial class Spikes : Area2D } break; case State.Opening: - _sprite.Play("default"); + _sprite.Play("activated"); KillBodiesOnButton(); break; case State.Closing: - _sprite.PlayBackwards("default"); + _sprite.PlayBackwards("activated"); + KillBodiesOnButton(); break; } } diff --git a/sprites/tiles/floor/spikes/spikes.tres b/sprites/tiles/floor/spikes/spikes.tres index c83293e..d417279 100644 --- a/sprites/tiles/floor/spikes/spikes.tres +++ b/sprites/tiles/floor/spikes/spikes.tres @@ -2,10 +2,6 @@ [ext_resource type="Texture2D" uid="uid://l3v1hs32uxfp" path="res://sprites/tiles/floor/spikes/spikes_0001-sheet.png" id="1_xhodh"] -[sub_resource type="AtlasTexture" id="AtlasTexture_ebjk6"] -atlas = ExtResource("1_xhodh") -region = Rect2(64, 0, 32, 32) - [sub_resource type="AtlasTexture" id="AtlasTexture_my1hb"] atlas = ExtResource("1_xhodh") region = Rect2(32, 0, 32, 32) @@ -14,19 +10,28 @@ region = Rect2(32, 0, 32, 32) atlas = ExtResource("1_xhodh") region = Rect2(0, 0, 32, 32) +[sub_resource type="AtlasTexture" id="AtlasTexture_qhlyu"] +atlas = ExtResource("1_xhodh") +region = Rect2(64, 0, 32, 32) + [resource] animations = [{ "frames": [{ "duration": 1.0, -"texture": SubResource("AtlasTexture_ebjk6") -}, { -"duration": 1.0, "texture": SubResource("AtlasTexture_my1hb") }, { "duration": 1.0, "texture": SubResource("AtlasTexture_nfdn1") }], "loop": false, +"name": &"activated", +"speed": 2.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_qhlyu") +}], +"loop": true, "name": &"default", -"speed": 3.0 +"speed": 5.0 }]