diff --git a/demo/demo/agents/agent_base.tscn b/demo/demo/agents/agent_base.tscn index a10bfc4..ebadbe6 100644 --- a/demo/demo/agents/agent_base.tscn +++ b/demo/demo/agents/agent_base.tscn @@ -1990,274 +1990,6 @@ tracks/20/keys = { "values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] } -[sub_resource type="Animation" id="Animation_msfb2"] -resource_name = "dash" -length = 0.4 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Root/Rig:position") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 0.1, 0.4), -"transitions": PackedFloat32Array(1, 1, 1), -"update": 0, -"values": [Vector2(0, -76), Vector2(0, -38), Vector2(0, -76)] -} -tracks/1/type = "value" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("Root/Rig:rotation") -tracks/1/interp = 2 -tracks/1/loop_wrap = true -tracks/1/keys = { -"times": PackedFloat32Array(0, 0.1, 0.2, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 2, -"values": [0.0, 2.35619, 6.28319, 12.5664] -} -tracks/2/type = "value" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath("Root/Rig:scale") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1, 1), -"update": 0, -"values": [Vector2(1, 1), Vector2(1, 0.5), Vector2(1, 0.5), Vector2(1, 0.5), Vector2(1, 1)] -} -tracks/3/type = "value" -tracks/3/imported = false -tracks/3/enabled = true -tracks/3/path = NodePath("Root/Rig/LegL:position") -tracks/3/interp = 1 -tracks/3/loop_wrap = true -tracks/3/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [Vector2(-29, 65), Vector2(-24.8287, 40.1066), Vector2(-24.8287, 40.1066), Vector2(-29, 65)] -} -tracks/4/type = "value" -tracks/4/imported = false -tracks/4/enabled = true -tracks/4/path = NodePath("Root/Rig/LegL:rotation") -tracks/4/interp = 1 -tracks/4/loop_wrap = true -tracks/4/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [0.0, 0.0, 0.0, 0.0] -} -tracks/5/type = "value" -tracks/5/imported = false -tracks/5/enabled = true -tracks/5/path = NodePath("Root/Rig/LegL:scale") -tracks/5/interp = 1 -tracks/5/loop_wrap = true -tracks/5/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] -} -tracks/6/type = "value" -tracks/6/imported = false -tracks/6/enabled = true -tracks/6/path = NodePath("Root/Rig/LegR:position") -tracks/6/interp = 1 -tracks/6/loop_wrap = true -tracks/6/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [Vector2(31, 65), Vector2(26.1794, 41.8884), Vector2(26.1794, 41.8884), Vector2(31, 65)] -} -tracks/7/type = "value" -tracks/7/imported = false -tracks/7/enabled = true -tracks/7/path = NodePath("Root/Rig/LegR:rotation") -tracks/7/interp = 1 -tracks/7/loop_wrap = true -tracks/7/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [0.0, 0.0, 0.0, 0.0] -} -tracks/8/type = "value" -tracks/8/imported = false -tracks/8/enabled = true -tracks/8/path = NodePath("Root/Rig/LegR:scale") -tracks/8/interp = 1 -tracks/8/loop_wrap = true -tracks/8/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] -} -tracks/9/type = "value" -tracks/9/imported = false -tracks/9/enabled = true -tracks/9/path = NodePath("Root/Rig/Body:position") -tracks/9/interp = 1 -tracks/9/loop_wrap = true -tracks/9/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [Vector2(5, 53), Vector2(5, 53), Vector2(5, 53), Vector2(5, 53)] -} -tracks/10/type = "value" -tracks/10/imported = false -tracks/10/enabled = true -tracks/10/path = NodePath("Root/Rig/Body:rotation") -tracks/10/interp = 1 -tracks/10/loop_wrap = true -tracks/10/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [0.0, 0.0, 0.0, 0.0] -} -tracks/11/type = "value" -tracks/11/imported = false -tracks/11/enabled = true -tracks/11/path = NodePath("Root/Rig/Body:scale") -tracks/11/interp = 1 -tracks/11/loop_wrap = true -tracks/11/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] -} -tracks/12/type = "value" -tracks/12/imported = false -tracks/12/enabled = true -tracks/12/path = NodePath("Root/Rig/Body/Hat:position") -tracks/12/interp = 1 -tracks/12/loop_wrap = true -tracks/12/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [Vector2(2, -91), Vector2(2, -91), Vector2(2, -91), Vector2(2, -91)] -} -tracks/13/type = "value" -tracks/13/imported = false -tracks/13/enabled = true -tracks/13/path = NodePath("Root/Rig/Body/Hat:rotation") -tracks/13/interp = 1 -tracks/13/loop_wrap = true -tracks/13/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [0.0, 0.0, 0.0, 0.0] -} -tracks/14/type = "value" -tracks/14/imported = false -tracks/14/enabled = true -tracks/14/path = NodePath("Root/Rig/Body/Hat:scale") -tracks/14/interp = 1 -tracks/14/loop_wrap = true -tracks/14/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] -} -tracks/15/type = "value" -tracks/15/imported = false -tracks/15/enabled = true -tracks/15/path = NodePath("Root/Rig/Body/HandL:position") -tracks/15/interp = 1 -tracks/15/loop_wrap = true -tracks/15/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [Vector2(-60, -53), Vector2(-19.9999, -52.9358), Vector2(-19.9999, -52.9358), Vector2(-60, -53)] -} -tracks/16/type = "value" -tracks/16/imported = false -tracks/16/enabled = true -tracks/16/path = NodePath("Root/Rig/Body/HandL:rotation") -tracks/16/interp = 1 -tracks/16/loop_wrap = true -tracks/16/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [0.0, 0.0, 0.0, 0.0] -} -tracks/17/type = "value" -tracks/17/imported = false -tracks/17/enabled = true -tracks/17/path = NodePath("Root/Rig/Body/HandL:scale") -tracks/17/interp = 1 -tracks/17/loop_wrap = true -tracks/17/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] -} -tracks/18/type = "value" -tracks/18/imported = false -tracks/18/enabled = true -tracks/18/path = NodePath("Root/Rig/Body/HandR:position") -tracks/18/interp = 1 -tracks/18/loop_wrap = true -tracks/18/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [Vector2(51, -51), Vector2(21.9955, -54.1155), Vector2(21.9955, -54.1155), Vector2(51, -51)] -} -tracks/19/type = "value" -tracks/19/imported = false -tracks/19/enabled = true -tracks/19/path = NodePath("Root/Rig/Body/HandR:rotation") -tracks/19/interp = 1 -tracks/19/loop_wrap = true -tracks/19/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [0.0, 0.0, 0.0, 0.0] -} -tracks/20/type = "value" -tracks/20/imported = false -tracks/20/enabled = true -tracks/20/path = NodePath("Root/Rig/Body/HandR:scale") -tracks/20/interp = 1 -tracks/20/loop_wrap = true -tracks/20/keys = { -"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), -"transitions": PackedFloat32Array(1, 1, 1, 1), -"update": 0, -"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] -} -tracks/21/type = "value" -tracks/21/imported = false -tracks/21/enabled = true -tracks/21/path = NodePath("Root/Hitbox/HitboxCollisionShape2D:disabled") -tracks/21/interp = 1 -tracks/21/loop_wrap = true -tracks/21/keys = { -"times": PackedFloat32Array(0, 0.4), -"transitions": PackedFloat32Array(1, 1), -"update": 1, -"values": [true, true] -} - [sub_resource type="Animation" id="Animation_wei72"] resource_name = "death" length = 0.5 @@ -4312,6 +4044,274 @@ tracks/19/keys = { "values": [true, true] } +[sub_resource type="Animation" id="Animation_msfb2"] +resource_name = "dodge" +length = 0.4 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Root/Rig:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.4), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [Vector2(0, -76), Vector2(0, -38), Vector2(0, -76)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Root/Rig:rotation") +tracks/1/interp = 2 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 2, +"values": [0.0, 2.35619, 6.28319, 12.5664] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Root/Rig:scale") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1), +"update": 0, +"values": [Vector2(1, 1), Vector2(1, 0.5), Vector2(1, 0.5), Vector2(1, 0.5), Vector2(1, 1)] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Root/Rig/LegL:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(-29, 65), Vector2(-24.8287, 40.1066), Vector2(-24.8287, 40.1066), Vector2(-29, 65)] +} +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("Root/Rig/LegL:rotation") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [0.0, 0.0, 0.0, 0.0] +} +tracks/5/type = "value" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("Root/Rig/LegL:scale") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] +} +tracks/6/type = "value" +tracks/6/imported = false +tracks/6/enabled = true +tracks/6/path = NodePath("Root/Rig/LegR:position") +tracks/6/interp = 1 +tracks/6/loop_wrap = true +tracks/6/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(31, 65), Vector2(26.1794, 41.8884), Vector2(26.1794, 41.8884), Vector2(31, 65)] +} +tracks/7/type = "value" +tracks/7/imported = false +tracks/7/enabled = true +tracks/7/path = NodePath("Root/Rig/LegR:rotation") +tracks/7/interp = 1 +tracks/7/loop_wrap = true +tracks/7/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [0.0, 0.0, 0.0, 0.0] +} +tracks/8/type = "value" +tracks/8/imported = false +tracks/8/enabled = true +tracks/8/path = NodePath("Root/Rig/LegR:scale") +tracks/8/interp = 1 +tracks/8/loop_wrap = true +tracks/8/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] +} +tracks/9/type = "value" +tracks/9/imported = false +tracks/9/enabled = true +tracks/9/path = NodePath("Root/Rig/Body:position") +tracks/9/interp = 1 +tracks/9/loop_wrap = true +tracks/9/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(5, 53), Vector2(5, 53), Vector2(5, 53), Vector2(5, 53)] +} +tracks/10/type = "value" +tracks/10/imported = false +tracks/10/enabled = true +tracks/10/path = NodePath("Root/Rig/Body:rotation") +tracks/10/interp = 1 +tracks/10/loop_wrap = true +tracks/10/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [0.0, 0.0, 0.0, 0.0] +} +tracks/11/type = "value" +tracks/11/imported = false +tracks/11/enabled = true +tracks/11/path = NodePath("Root/Rig/Body:scale") +tracks/11/interp = 1 +tracks/11/loop_wrap = true +tracks/11/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] +} +tracks/12/type = "value" +tracks/12/imported = false +tracks/12/enabled = true +tracks/12/path = NodePath("Root/Rig/Body/Hat:position") +tracks/12/interp = 1 +tracks/12/loop_wrap = true +tracks/12/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(2, -91), Vector2(2, -91), Vector2(2, -91), Vector2(2, -91)] +} +tracks/13/type = "value" +tracks/13/imported = false +tracks/13/enabled = true +tracks/13/path = NodePath("Root/Rig/Body/Hat:rotation") +tracks/13/interp = 1 +tracks/13/loop_wrap = true +tracks/13/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [0.0, 0.0, 0.0, 0.0] +} +tracks/14/type = "value" +tracks/14/imported = false +tracks/14/enabled = true +tracks/14/path = NodePath("Root/Rig/Body/Hat:scale") +tracks/14/interp = 1 +tracks/14/loop_wrap = true +tracks/14/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] +} +tracks/15/type = "value" +tracks/15/imported = false +tracks/15/enabled = true +tracks/15/path = NodePath("Root/Rig/Body/HandL:position") +tracks/15/interp = 1 +tracks/15/loop_wrap = true +tracks/15/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(-60, -53), Vector2(-19.9999, -52.9358), Vector2(-19.9999, -52.9358), Vector2(-60, -53)] +} +tracks/16/type = "value" +tracks/16/imported = false +tracks/16/enabled = true +tracks/16/path = NodePath("Root/Rig/Body/HandL:rotation") +tracks/16/interp = 1 +tracks/16/loop_wrap = true +tracks/16/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [0.0, 0.0, 0.0, 0.0] +} +tracks/17/type = "value" +tracks/17/imported = false +tracks/17/enabled = true +tracks/17/path = NodePath("Root/Rig/Body/HandL:scale") +tracks/17/interp = 1 +tracks/17/loop_wrap = true +tracks/17/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] +} +tracks/18/type = "value" +tracks/18/imported = false +tracks/18/enabled = true +tracks/18/path = NodePath("Root/Rig/Body/HandR:position") +tracks/18/interp = 1 +tracks/18/loop_wrap = true +tracks/18/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(51, -51), Vector2(21.9955, -54.1155), Vector2(21.9955, -54.1155), Vector2(51, -51)] +} +tracks/19/type = "value" +tracks/19/imported = false +tracks/19/enabled = true +tracks/19/path = NodePath("Root/Rig/Body/HandR:rotation") +tracks/19/interp = 1 +tracks/19/loop_wrap = true +tracks/19/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [0.0, 0.0, 0.0, 0.0] +} +tracks/20/type = "value" +tracks/20/imported = false +tracks/20/enabled = true +tracks/20/path = NodePath("Root/Rig/Body/HandR:scale") +tracks/20/interp = 1 +tracks/20/loop_wrap = true +tracks/20/keys = { +"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] +} +tracks/21/type = "value" +tracks/21/imported = false +tracks/21/enabled = true +tracks/21/path = NodePath("Root/Hitbox/HitboxCollisionShape2D:disabled") +tracks/21/interp = 1 +tracks/21/loop_wrap = true +tracks/21/keys = { +"times": PackedFloat32Array(0, 0.4), +"transitions": PackedFloat32Array(1, 1), +"update": 1, +"values": [true, true] +} + [sub_resource type="AnimationLibrary" id="AnimationLibrary_ws2ti"] _data = { "RESET": SubResource("Animation_nvm4d"), @@ -4321,8 +4321,8 @@ _data = { "charge": SubResource("Animation_jcwlt"), "charge_prepare": SubResource("Animation_sva81"), "dance": SubResource("Animation_5k1rd"), -"dash": SubResource("Animation_msfb2"), "death": SubResource("Animation_wei72"), +"dodge": SubResource("Animation_msfb2"), "hurt": SubResource("Animation_gowr5"), "idle": SubResource("Animation_gnqgt"), "spit": SubResource("Animation_uow76"), @@ -4396,8 +4396,8 @@ region_rect = Rect2(111, 34, 26.9272, 26.6298) [node name="WeaponNinjaStar" type="Sprite2D" parent="Root"] visible = false -position = Vector2(20.8026, -11.5702) -rotation = -1.60228 +position = Vector2(-55, -76.0016) +rotation = 2.89599e-05 scale = Vector2(0.999985, 0.999984) texture = ExtResource("4_1c5xq") diff --git a/demo/demo/agents/player/DashState.gd b/demo/demo/agents/player/DodgeState.gd similarity index 88% rename from demo/demo/agents/player/DashState.gd rename to demo/demo/agents/player/DodgeState.gd index ff22449..18e7643 100644 --- a/demo/demo/agents/player/DashState.gd +++ b/demo/demo/agents/player/DodgeState.gd @@ -1,11 +1,11 @@ extends LimboState -## Idle state. +## Dodge state. @export var animation_player: AnimationPlayer @export var animation: StringName @export var duration: float = 0.4 -@export var dash_speed: float = 1000.0 +@export var dodge_speed: float = 1000.0 @export var hurtbox_collision: CollisionShape2D var move_dir: Vector2 @@ -32,7 +32,7 @@ func _exit() -> void: func _update(p_delta: float) -> void: elapsed_time += p_delta - var desired_velocity: Vector2 = move_dir * dash_speed + var desired_velocity: Vector2 = move_dir * dodge_speed agent.velocity = lerp(agent.velocity, desired_velocity, 0.2) agent.move_and_slide() if elapsed_time > duration: diff --git a/demo/demo/agents/player/player.gd b/demo/demo/agents/player/player.gd index cbc2c04..177b786 100644 --- a/demo/demo/agents/player/player.gd +++ b/demo/demo/agents/player/player.gd @@ -12,20 +12,20 @@ extends "res://demo/agents/scripts/agent_base.gd" ## Player. -@export var dash_cooldown: float = 0.4 +@export var dodge_cooldown: float = 0.4 @onready var hsm: LimboHSM = $LimboHSM @onready var idle_state: LimboState = $LimboHSM/IdleState @onready var move_state: LimboState = $LimboHSM/MoveState @onready var attack_state: LimboState = $LimboHSM/AttackState -@onready var dash_state: LimboState = $LimboHSM/DashState +@onready var dodge_state: LimboState = $LimboHSM/DodgeState -var can_dash: bool = true +var can_dodge: bool = true func _ready() -> void: super._ready() - can_dash = true + can_dodge = true _init_state_machine() death.connect(func(): remove_from_group(&"player")) @@ -35,8 +35,8 @@ func _unhandled_input(event: InputEvent) -> void: return if event.is_action_pressed("attack"): hsm.dispatch("attack!") - if event.is_action_pressed("dash"): - hsm.dispatch("dash!") + if event.is_action_pressed("dodge"): + hsm.dispatch("dodge!") func _init_state_machine() -> void: @@ -45,21 +45,21 @@ func _init_state_machine() -> void: hsm.add_transition(idle_state, attack_state, "attack!") hsm.add_transition(move_state, attack_state, "attack!") hsm.add_transition(attack_state, move_state, attack_state.EVENT_FINISHED) - hsm.add_transition(hsm.ANYSTATE, dash_state, "dash!") - hsm.add_transition(dash_state, move_state, dash_state.EVENT_FINISHED) - dash_state.set_guard(_can_dash) + hsm.add_transition(hsm.ANYSTATE, dodge_state, "dodge!") + hsm.add_transition(dodge_state, move_state, dodge_state.EVENT_FINISHED) + dodge_state.set_guard(_can_dodge) hsm.initialize(self) hsm.set_active(true) - hsm.set_guard(_can_dash) + hsm.set_guard(_can_dodge) func set_victorious() -> void: idle_state.idle_animation = &"dance" -func _can_dash() -> bool: - if can_dash: - can_dash = false - get_tree().create_timer(dash_cooldown).timeout.connect(func(): can_dash = true) +func _can_dodge() -> bool: + if can_dodge: + can_dodge = false + get_tree().create_timer(dodge_cooldown).timeout.connect(func(): can_dodge = true) return true return false diff --git a/demo/demo/agents/player/player.tscn b/demo/demo/agents/player/player.tscn index 8b51b49..1ff8364 100644 --- a/demo/demo/agents/player/player.tscn +++ b/demo/demo/agents/player/player.tscn @@ -5,7 +5,7 @@ [ext_resource type="Script" path="res://demo/agents/player/states/idle_state.gd" id="3_ekb12"] [ext_resource type="Script" path="res://demo/agents/player/states/move_state.gd" id="4_paikn"] [ext_resource type="Script" path="res://demo/agents/player/states/attack_state.gd" id="5_mpgu6"] -[ext_resource type="Script" path="res://demo/agents/player/DashState.gd" id="6_hdeid"] +[ext_resource type="Script" path="res://demo/agents/player/DodgeState.gd" id="6_7o4a6"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_8pofm"] size = Vector2(130, 45) @@ -14,7 +14,7 @@ size = Vector2(130, 45) collision_layer = 0 collision_mask = 1 script = ExtResource("2_24nyi") -dash_cooldown = 0.4 +dodge_cooldown = 0.4 [node name="WeaponNinjaStar" parent="Root" index="1"] position = Vector2(-55, -76) @@ -51,8 +51,8 @@ animation_player = NodePath("../../AnimationPlayer") animations = Array[StringName]([&"attack_1", &"attack_2", &"attack_3"]) hitbox = NodePath("../../Root/Hitbox") -[node name="DashState" type="LimboState" parent="LimboHSM" index="3" node_paths=PackedStringArray("animation_player", "hurtbox_collision")] -script = ExtResource("6_hdeid") +[node name="DodgeState" type="LimboState" parent="LimboHSM" index="3" node_paths=PackedStringArray("animation_player", "hurtbox_collision")] +script = ExtResource("6_7o4a6") animation_player = NodePath("../../AnimationPlayer") -animation = &"dash" +animation = &"dodge" hurtbox_collision = NodePath("../../Root/Hurtbox/HurtboxCollisionShape2D") diff --git a/demo/demo/scenes/demo.tscn b/demo/demo/scenes/demo.tscn index cb8879d..822407d 100644 --- a/demo/demo/scenes/demo.tscn +++ b/demo/demo/scenes/demo.tscn @@ -109,11 +109,11 @@ offset_bottom = 39.0 grow_horizontal = 0 grow_vertical = 0 -[node name="Label" type="Label" parent="UI Layer/Control/VBoxContainer"] +[node name="Controls" type="Label" parent="UI Layer/Control/VBoxContainer"] layout_mode = 2 text = "Move WASD Attack ENTER or F -Dash SPACE" +Dodge SPACE" label_settings = SubResource("LabelSettings_0r6iv") [node name="HPBar" type="TextureProgressBar" parent="UI Layer/Control"] diff --git a/demo/project.godot b/demo/project.godot index a6727da..7b27a2d 100644 --- a/demo/project.godot +++ b/demo/project.godot @@ -52,7 +52,7 @@ attack={ , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":102,"echo":false,"script":null) ] } -dash={ +dodge={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"echo":false,"script":null) ]