Demo: Numerous improvements, refactoring and comments

This commit is contained in:
Serhii Snitsaruk 2024-02-05 16:26:40 +01:00
parent dae96feeb9
commit 1de059d806
28 changed files with 730 additions and 540 deletions

View File

@ -11,10 +11,10 @@
[ext_resource type="Script" path="res://demo/agents/scripts/hurtbox.gd" id="6_jnvxm"] [ext_resource type="Script" path="res://demo/agents/scripts/hurtbox.gd" id="6_jnvxm"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2k81i"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_2k81i"]
size = Vector2(130, 35) size = Vector2(140, 40)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_26abe"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_26abe"]
size = Vector2(80, 35) size = Vector2(88, 40)
[sub_resource type="Curve" id="Curve_noh01"] [sub_resource type="Curve" id="Curve_noh01"]
_data = [Vector2(0, 0.010989), 0.0, 0.0, 0, 0, Vector2(0.151111, 1), 1.3559, 1.3559, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] _data = [Vector2(0, 0.010989), 0.0, 0.0, 0, 0, Vector2(0.151111, 1), 1.3559, 1.3559, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
@ -399,6 +399,18 @@ tracks/26/keys = {
"update": 1, "update": 1,
"values": [false] "values": [false]
} }
tracks/27/type = "value"
tracks/27/imported = false
tracks/27/enabled = true
tracks/27/path = NodePath("Root/Hurtbox/HurtboxCollisionShape2D:disabled")
tracks/27/interp = 1
tracks/27/loop_wrap = true
tracks/27/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_8wj70"] [sub_resource type="Animation" id="Animation_8wj70"]
resource_name = "attack_1" resource_name = "attack_1"
@ -668,6 +680,18 @@ tracks/21/keys = {
"update": 1, "update": 1,
"values": [true, false, true, true] "values": [true, false, true, true]
} }
tracks/22/type = "value"
tracks/22/imported = false
tracks/22/enabled = true
tracks/22/path = NodePath("Root/Hitbox:knockback_enabled")
tracks/22/interp = 1
tracks/22/loop_wrap = true
tracks/22/keys = {
"times": PackedFloat32Array(0, 0.1, 0.3),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [false, false, false]
}
[sub_resource type="Animation" id="Animation_s1dey"] [sub_resource type="Animation" id="Animation_s1dey"]
resource_name = "attack_2" resource_name = "attack_2"
@ -937,6 +961,18 @@ tracks/21/keys = {
"update": 1, "update": 1,
"values": [true, false, true] "values": [true, false, true]
} }
tracks/22/type = "value"
tracks/22/imported = false
tracks/22/enabled = true
tracks/22/path = NodePath("Root/Hitbox:knockback_enabled")
tracks/22/interp = 1
tracks/22/loop_wrap = true
tracks/22/keys = {
"times": PackedFloat32Array(0, 0.2, 0.3),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [false, false, false]
}
[sub_resource type="Animation" id="Animation_g7a0r"] [sub_resource type="Animation" id="Animation_g7a0r"]
resource_name = "attack_3" resource_name = "attack_3"
@ -2295,6 +2331,286 @@ tracks/24/keys = {
"values": [false, false] "values": [false, false]
} }
[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.0001, 0.1, 0.2, 0.3, 0.4),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [true, true, true, true, true, true]
}
tracks/22/type = "value"
tracks/22/imported = false
tracks/22/enabled = true
tracks/22/path = NodePath("Root/Hurtbox/HurtboxCollisionShape2D:disabled")
tracks/22/interp = 1
tracks/22/loop_wrap = true
tracks/22/keys = {
"times": PackedFloat32Array(0, 0.4),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [true, false]
}
[sub_resource type="Animation" id="Animation_gowr5"] [sub_resource type="Animation" id="Animation_gowr5"]
resource_name = "hurt" resource_name = "hurt"
length = 0.25 length = 0.25
@ -4043,273 +4359,17 @@ tracks/19/keys = {
"update": 1, "update": 1,
"values": [true, true] "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/type = "value"
tracks/20/imported = false tracks/20/imported = false
tracks/20/enabled = true tracks/20/enabled = true
tracks/20/path = NodePath("Root/Rig/Body/HandR:scale") tracks/20/path = NodePath("Root/Hurtbox/HurtboxCollisionShape2D:disabled")
tracks/20/interp = 1 tracks/20/interp = 1
tracks/20/loop_wrap = true tracks/20/loop_wrap = true
tracks/20/keys = { tracks/20/keys = {
"times": PackedFloat32Array(0, 0.1, 0.3, 0.4), "times": PackedFloat32Array(0, 0.6),
"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), "transitions": PackedFloat32Array(1, 1),
"update": 1, "update": 1,
"values": [true, true] "values": [false, false]
} }
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ws2ti"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_ws2ti"]
@ -4396,9 +4456,8 @@ region_rect = Rect2(111, 34, 26.9272, 26.6298)
[node name="WeaponNinjaStar" type="Sprite2D" parent="Root"] [node name="WeaponNinjaStar" type="Sprite2D" parent="Root"]
visible = false visible = false
position = Vector2(-55, -76.0016) position = Vector2(-55, -76)
rotation = 2.89599e-05 scale = Vector2(0.999982, 0.999981)
scale = Vector2(0.999985, 0.999984)
texture = ExtResource("4_1c5xq") texture = ExtResource("4_1c5xq")
[node name="Hitbox" type="Area2D" parent="Root"] [node name="Hitbox" type="Area2D" parent="Root"]
@ -4468,6 +4527,7 @@ shape = SubResource("CircleShape2D_0c228")
script = ExtResource("4_qwtrf") script = ExtResource("4_qwtrf")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
callback_mode_method = 1
libraries = { libraries = {
"": SubResource("AnimationLibrary_ws2ti") "": SubResource("AnimationLibrary_ws2ti")
} }

View File

@ -7,7 +7,7 @@
[ext_resource type="Texture2D" uid="uid://bdusy0qqtw0th" path="res://demo/assets/smoke.png" id="5_t37aw"] [ext_resource type="Texture2D" uid="uid://bdusy0qqtw0th" path="res://demo/assets/smoke.png" id="5_t37aw"]
[sub_resource type="CircleShape2D" id="CircleShape2D_7uc1b"] [sub_resource type="CircleShape2D" id="CircleShape2D_7uc1b"]
radius = 25.13 radius = 28.0
[sub_resource type="Curve" id="Curve_ugmtv"] [sub_resource type="Curve" id="Curve_ugmtv"]
_data = [Vector2(0, 0.010989), 0.0, 0.0, 0, 0, Vector2(0.151111, 1), 1.3559, 1.3559, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] _data = [Vector2(0, 0.010989), 0.0, 0.0, 0, 0, Vector2(0.151111, 1), 1.3559, 1.3559, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]

View File

@ -21,6 +21,7 @@ extends "res://demo/agents/scripts/agent_base.gd"
@onready var dodge_state: LimboState = $LimboHSM/DodgeState @onready var dodge_state: LimboState = $LimboHSM/DodgeState
var can_dodge: bool = true var can_dodge: bool = true
var attack_pressed: bool = false
func _ready() -> void: func _ready() -> void:
@ -34,11 +35,19 @@ func _unhandled_input(event: InputEvent) -> void:
if event.is_echo(): if event.is_echo():
return return
if event.is_action_pressed("attack"): if event.is_action_pressed("attack"):
hsm.dispatch("attack!") attack_pressed = true
_process_attack_input()
if event.is_action_pressed("dodge"): if event.is_action_pressed("dodge"):
hsm.dispatch("dodge!") hsm.dispatch("dodge!")
func _process_attack_input() -> void:
if not attack_pressed or hsm.get_active_state() == attack_state:
return
hsm.dispatch("attack!")
attack_pressed = false
func _init_state_machine() -> void: func _init_state_machine() -> void:
hsm.add_transition(idle_state, move_state, idle_state.EVENT_FINISHED) hsm.add_transition(idle_state, move_state, idle_state.EVENT_FINISHED)
hsm.add_transition(move_state, idle_state, move_state.EVENT_FINISHED) hsm.add_transition(move_state, idle_state, move_state.EVENT_FINISHED)
@ -47,7 +56,14 @@ func _init_state_machine() -> void:
hsm.add_transition(attack_state, move_state, attack_state.EVENT_FINISHED) hsm.add_transition(attack_state, move_state, attack_state.EVENT_FINISHED)
hsm.add_transition(hsm.ANYSTATE, dodge_state, "dodge!") hsm.add_transition(hsm.ANYSTATE, dodge_state, "dodge!")
hsm.add_transition(dodge_state, move_state, dodge_state.EVENT_FINISHED) hsm.add_transition(dodge_state, move_state, dodge_state.EVENT_FINISHED)
dodge_state.set_guard(_can_dodge) dodge_state.set_guard(_can_dodge)
attack_state.set_guard(attack_state.can_enter)
# Process attack input buffer when move_state is entered.
# This way we can buffer the attack button presses and chain the attacks.
move_state.call_on_enter(_process_attack_input)
hsm.initialize(self) hsm.initialize(self)
hsm.set_active(true) hsm.set_active(true)
hsm.set_guard(_can_dodge) hsm.set_guard(_can_dodge)

View File

@ -5,10 +5,10 @@
[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/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/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/states/attack_state.gd" id="5_mpgu6"]
[ext_resource type="Script" path="res://demo/agents/player/DodgeState.gd" id="6_7o4a6"] [ext_resource type="Script" path="res://demo/agents/player/states/dodge_state.gd" id="6_7o4a6"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8pofm"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_8pofm"]
size = Vector2(130, 45) size = Vector2(150, 50)
[node name="Player" groups=["player"] instance=ExtResource("1_mswd4")] [node name="Player" groups=["player"] instance=ExtResource("1_mswd4")]
collision_layer = 0 collision_layer = 0
@ -17,9 +17,7 @@ script = ExtResource("2_24nyi")
dodge_cooldown = 0.4 dodge_cooldown = 0.4
[node name="WeaponNinjaStar" parent="Root" index="1"] [node name="WeaponNinjaStar" parent="Root" index="1"]
position = Vector2(-55, -76) scale = Vector2(0.999983, 0.999974)
rotation = 0.0
scale = Vector2(0.999983, 0.999976)
[node name="Hitbox" parent="Root" index="2"] [node name="Hitbox" parent="Root" index="2"]
collision_mask = 8 collision_mask = 8

View File

@ -16,31 +16,45 @@ extends LimboState
@export var animations: Array[StringName] @export var animations: Array[StringName]
@export var hitbox: Hitbox @export var hitbox: Hitbox
var attack_pressed: int ## Cooldown duration after third attack in the combo is complete.
@export var combo_cooldown: float = 0.1
var anim_index: int = 0
var last_attack_msec: int = -10000
var _can_enter: bool = true
func _unhandled_input(event: InputEvent) -> void: ## This func is used to prevent entering this state using LimboState.set_guard().
if event.is_echo(): ## Entry is denied for a short duration after the third attack in the combo is complete.
return func can_enter() -> bool:
if event.is_action_pressed("attack"): return _can_enter
attack_pressed += 1
func _enter() -> void: func _enter() -> void:
attack_pressed = 0 if (Time.get_ticks_msec() - last_attack_msec) < 200:
hitbox.damage = 1 # Perform next attack animation in the 3-part combo, if an attack was recently performed.
for idx in animations.size(): anim_index = (anim_index + 1) % 3
hitbox.damage = 2 if idx == 2 else 1 # deal 2 damage on third attack else:
animation_player.play(animations[idx]) anim_index = 0
var horizontal_move: float = Input.get_axis(&"move_left", &"move_right")
if not is_zero_approx(horizontal_move):
agent.face_dir(horizontal_move)
hitbox.damage = 2 if anim_index == 2 else 1 # deal 2 damage on a third attack in the combo
animation_player.play(animations[anim_index])
await animation_player.animation_finished await animation_player.animation_finished
if attack_pressed <= 0 or not is_active():
# Interrupt combo if player didn't press attack button again,
# or state is no longer active.
break
attack_pressed -= 1
if is_active(): if is_active():
get_root().dispatch(EVENT_FINISHED) get_root().dispatch(EVENT_FINISHED)
func _exit() -> void: func _exit() -> void:
hitbox.damage = 1 hitbox.damage = 1
last_attack_msec = Time.get_ticks_msec()
if anim_index == 2 and _can_enter:
# Prevent entering this state for a short duration after the third attack
# in the combo sequence is complete.
_can_enter = false
await get_tree().create_timer(combo_cooldown).timeout
_can_enter = true

View File

@ -1,3 +1,13 @@
#*
#* dodge_state.gd
#* =============================================================================
#* Copyright 2021-2024 Serhii Snitsaruk
#*
#* Use of this source code is governed by an MIT-style
#* license that can be found in the LICENSE file or at
#* https://opensource.org/licenses/MIT.
#* =============================================================================
#*
extends LimboState extends LimboState
## Dodge state. ## Dodge state.
@ -33,7 +43,6 @@ func _exit() -> void:
func _update(p_delta: float) -> void: func _update(p_delta: float) -> void:
elapsed_time += p_delta elapsed_time += p_delta
var desired_velocity: Vector2 = move_dir * dodge_speed var desired_velocity: Vector2 = move_dir * dodge_speed
agent.velocity = lerp(agent.velocity, desired_velocity, 0.2) agent.move(desired_velocity)
agent.move_and_slide()
if elapsed_time > duration: if elapsed_time > duration:
get_root().dispatch(EVENT_FINISHED) get_root().dispatch(EVENT_FINISHED)

View File

@ -27,10 +27,11 @@ func _update(_delta: float) -> void:
var horizontal_move: float = Input.get_axis(&"move_left", &"move_right") var horizontal_move: float = Input.get_axis(&"move_left", &"move_right")
var vertical_move: float = Input.get_axis(&"move_up", &"move_down") var vertical_move: float = Input.get_axis(&"move_up", &"move_down")
if not is_zero_approx(horizontal_move):
agent.face_dir(horizontal_move)
var desired_velocity := Vector2(horizontal_move, vertical_move * VERTICAL_FACTOR) * speed var desired_velocity := Vector2(horizontal_move, vertical_move * VERTICAL_FACTOR) * speed
agent.velocity = lerp(agent.velocity, desired_velocity, 0.2) agent.move(desired_velocity)
agent.move_and_slide()
agent.update_facing()
if horizontal_move == 0.0 and vertical_move == 0.0: if horizontal_move == 0.0 and vertical_move == 0.0:
get_root().dispatch(EVENT_FINISHED) get_root().dispatch(EVENT_FINISHED)

View File

@ -20,8 +20,11 @@ const MINION_RESOURCE := "res://demo/agents/03_agent_imp.tscn"
const NinjaStar := preload("res://demo/agents/ninja_star/ninja_star.tscn") const NinjaStar := preload("res://demo/agents/ninja_star/ninja_star.tscn")
const Fireball := preload("res://demo/agents/fireball/fireball.tscn") const Fireball := preload("res://demo/agents/fireball/fireball.tscn")
var summon_count: int = 0
var _frames_since_facing_update: int = 0 var _frames_since_facing_update: int = 0
var _is_dead: bool = false var _is_dead: bool = false
var _moved_this_frame: bool = false
@onready var animation_player: AnimationPlayer = $AnimationPlayer @onready var animation_player: AnimationPlayer = $AnimationPlayer
@onready var health: Health = $Health @onready var health: Health = $Health
@ -34,6 +37,23 @@ func _ready() -> void:
health.damaged.connect(_damaged) health.damaged.connect(_damaged)
health.death.connect(die) health.death.connect(die)
func _physics_process(_delta: float) -> void:
_post_physics_process.call_deferred()
func _post_physics_process() -> void:
if not _moved_this_frame:
velocity = lerp(velocity, Vector2.ZERO, 0.5)
_moved_this_frame = false
func move(p_velocity: Vector2) -> void:
velocity = lerp(velocity, p_velocity, 0.2)
move_and_slide()
_moved_this_frame = true
## Update agent's facing in the velocity direction. ## Update agent's facing in the velocity direction.
func update_facing() -> void: func update_facing() -> void:
_frames_since_facing_update += 1 _frames_since_facing_update += 1
@ -74,6 +94,8 @@ func summon_minion(p_position: Vector2) -> void:
get_parent().add_child(minion) get_parent().add_child(minion)
minion.position = p_position minion.position = p_position
minion.play_summoning_effect() minion.play_summoning_effect()
summon_count += 1
minion.death.connect(func(): summon_count -= 1)
## Method is used when this agent is summoned from the dungeons of the castle AaaAaaAAAAAaaAAaaaaaa ## Method is used when this agent is summoned from the dungeons of the castle AaaAaaAAAAAaaAAaaaaaa
@ -113,8 +135,7 @@ func apply_knockback(knockback: Vector2, frames: int = 10) -> void:
if knockback.is_zero_approx(): if knockback.is_zero_approx():
return return
for i in range(frames): for i in range(frames):
velocity = lerp(velocity, knockback, 0.2) move(knockback)
move_and_slide()
await get_tree().physics_frame await get_tree().physics_frame

View File

@ -23,12 +23,18 @@ extends BTAction
## How close should the agent be to the target position to return SUCCESS. ## How close should the agent be to the target position to return SUCCESS.
@export var tolerance := 50.0 @export var tolerance := 50.0
## Specifies the node to avoid (valid Node2D is expected).
## If not empty, agent will circle around the node while moving into position.
@export var avoid_var: String
func _generate_name() -> String: func _generate_name() -> String:
return "Arrive pos: %s" % [ return "Arrive pos: %s%s" % [
LimboUtility.decorate_var(target_position_var), LimboUtility.decorate_var(target_position_var),
"" if avoid_var.is_empty() else " avoid: " + LimboUtility.decorate_var(avoid_var)
] ]
func _tick(_delta: float) -> Status: func _tick(_delta: float) -> Status:
var target_pos: Vector2 = blackboard.get_var(target_position_var, Vector2.ZERO) var target_pos: Vector2 = blackboard.get_var(target_position_var, Vector2.ZERO)
if target_pos.distance_to(agent.global_position) < tolerance: if target_pos.distance_to(agent.global_position) < tolerance:
@ -43,8 +49,21 @@ func _tick(_delta: float) -> Status:
vertical_factor = clampf(vertical_factor, 0.0, 1.0) vertical_factor = clampf(vertical_factor, 0.0, 1.0)
dir.y *= vertical_factor dir.y *= vertical_factor
# Avoid the node specified by `avoid_var`.
# I.e., if `avoid_var` is set, agent will circle around that node while moving into position.
if not avoid_var.is_empty():
var avoid_node: Node2D = blackboard.get_var(avoid_var)
if is_instance_valid(avoid_node):
var distance_vector: Vector2 = avoid_node.global_position - agent.global_position
if dir.dot(distance_vector) > 0.0:
var side := dir.rotated(PI * 0.5).normalized()
# The closer we are to the avoid target, the stronger is the avoidance.
var strength: float = remap(distance_vector.length(), 200.0, 400.0, 1.0, 0.0)
strength = clampf(strength, 0.0, 1.0)
var avoidance := side * signf(-side.dot(distance_vector)) * strength
dir += avoidance
var desired_velocity: Vector2 = dir.normalized() * speed var desired_velocity: Vector2 = dir.normalized() * speed
agent.velocity = lerp(agent.velocity, desired_velocity, 0.2) agent.move(desired_velocity)
agent.move_and_slide()
agent.update_facing() agent.update_facing()
return RUNNING return RUNNING

View File

@ -34,7 +34,6 @@ func _enter() -> void:
# Called each time this task is ticked (aka executed). # Called each time this task is ticked (aka executed).
func _tick(_delta: float) -> Status: func _tick(_delta: float) -> Status:
agent.velocity = lerp(agent.velocity, _desired_velocity, 0.2) agent.move(_desired_velocity)
agent.move_and_slide()
agent.face_dir(-signf(_dir.x)) agent.face_dir(-signf(_dir.x))
return RUNNING return RUNNING

View File

@ -0,0 +1,35 @@
#*
#* is_aligned_with_target.gd
#* =============================================================================
#* Copyright 2021-2024 Serhii Snitsaruk
#*
#* Use of this source code is governed by an MIT-style
#* license that can be found in the LICENSE file or at
#* https://opensource.org/licenses/MIT.
#* =============================================================================
#*
@tool
extends BTCondition
## IsAlignedWithTarget
## Returns SUCCESS if the agent is horizontally aligned with the target.
## Returns FAILURE if not aligned or if target is not a valid node instance.
@export var target_var: String = "target"
@export var tolerance: float = 30.0
# Display a customized name (requires @tool).
func _generate_name() -> String:
return "IsAlignedWithTarget " + LimboUtility.decorate_var(target_var)
# Called each time this task is ticked (aka executed).
func _tick(_delta: float) -> Status:
var target := blackboard.get_var(target_var) as Node2D
if not is_instance_valid(target):
return FAILURE
var y_diff: float = absf(target.global_position.y - agent.global_position.y)
if y_diff < tolerance:
return SUCCESS
return FAILURE

View File

@ -31,8 +31,7 @@ func _tick(_delta: float) -> Status:
var facing: float = agent.get_facing() var facing: float = agent.get_facing()
var speed: float = blackboard.get_var(speed_var, 100.0) var speed: float = blackboard.get_var(speed_var, 100.0)
var desired_velocity: Vector2 = Vector2.RIGHT * facing * speed var desired_velocity: Vector2 = Vector2.RIGHT * facing * speed
agent.velocity = lerp(agent.velocity, desired_velocity, 0.2) agent.move(desired_velocity)
agent.move_and_slide()
agent.update_facing() agent.update_facing()
if elapsed_time > duration: if elapsed_time > duration:
return SUCCESS return SUCCESS

View File

@ -60,8 +60,7 @@ func _tick(_delta: float) -> Status:
var speed: float = blackboard.get_var(speed_var, 200.0) var speed: float = blackboard.get_var(speed_var, 200.0)
var desired_velocity: Vector2 = agent.global_position.direction_to(_waypoint) * speed var desired_velocity: Vector2 = agent.global_position.direction_to(_waypoint) * speed
agent.velocity = lerp(agent.velocity, desired_velocity, 0.2) agent.move(desired_velocity)
agent.move_and_slide()
agent.update_facing() agent.update_facing()
return RUNNING return RUNNING

View File

@ -63,8 +63,12 @@ func _tick(_delta: float) -> Status:
AgentSide.FRONT: AgentSide.FRONT:
dir = target.get_facing() dir = target.get_facing()
var flank_pos: Vector2 = target.global_position var flank_pos: Vector2
flank_pos.x += dir * randf_range(range_min, range_max) var offset := Vector2(dir * randf_range(range_min, range_max), 0.0)
flank_pos = target.global_position + offset
if not agent.is_good_position(flank_pos):
# Choose the opposite side if preferred is not good (i.e., inside a collision shape).
flank_pos = target.global_position - offset
blackboard.set_var(position_var, flank_pos) blackboard.set_var(position_var, flank_pos)
return SUCCESS return SUCCESS

View File

@ -61,6 +61,7 @@ script = ExtResource("3_u2ra5")
target_position_var = "flank_pos" target_position_var = "flank_pos"
speed_var = "speed" speed_var = "speed"
tolerance = 50.0 tolerance = 50.0
avoid_var = ""
[sub_resource type="BTTimeLimit" id="BTTimeLimit_is5ag"] [sub_resource type="BTTimeLimit" id="BTTimeLimit_is5ag"]
time_limit = 3.0 time_limit = 3.0
@ -85,6 +86,7 @@ animation_name = &"charge_prepare"
blend = 0.1 blend = 0.1
[sub_resource type="BTWait" id="BTWait_ovu3r"] [sub_resource type="BTWait" id="BTWait_ovu3r"]
duration = 0.6
[sub_resource type="BTSequence" id="BTSequence_mde2g"] [sub_resource type="BTSequence" id="BTSequence_mde2g"]
custom_name = "Anticipation" custom_name = "Anticipation"
@ -102,7 +104,7 @@ blend = 0.05
[sub_resource type="BTAction" id="BTAction_o18uk"] [sub_resource type="BTAction" id="BTAction_o18uk"]
script = ExtResource("5_ucvak") script = ExtResource("5_ucvak")
speed_var = "charge_speed" speed_var = "charge_speed"
duration = 2.0 duration = 1.5
[sub_resource type="BTSequence" id="BTSequence_8lur1"] [sub_resource type="BTSequence" id="BTSequence_8lur1"]
custom_name = "Charge!" custom_name = "Charge!"

View File

@ -1,4 +1,4 @@
[gd_resource type="BehaviorTree" load_steps=35 format=3 uid="uid://c2bxoo68ywb27"] [gd_resource type="BehaviorTree" load_steps=30 format=3 uid="uid://c2bxoo68ywb27"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_random_nearby_pos.gd" id="1_cdtqu"] [ext_resource type="Script" path="res://demo/ai/tasks/select_random_nearby_pos.gd" id="1_cdtqu"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="2_31fsn"] [ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="2_31fsn"]
@ -13,24 +13,6 @@ var/speed/value = 400.0
var/speed/hint = 1 var/speed/hint = 1
var/speed/hint_string = "10,1000,10" var/speed/hint_string = "10,1000,10"
[sub_resource type="BBNode" id="BBNode_6xa35"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_4q5m7"]
animation_player = SubResource("BBNode_6xa35")
animation_name = &"idle"
blend = 0.1
[sub_resource type="BTRandomWait" id="BTRandomWait_025eh"]
[sub_resource type="BTSequence" id="BTSequence_ds6uq"]
custom_name = "Idle"
children = [SubResource("BTPlayAnimation_4q5m7"), SubResource("BTRandomWait_025eh")]
[sub_resource type="BTCooldown" id="BTCooldown_u2lrv"]
children = [SubResource("BTSequence_ds6uq")]
[sub_resource type="BBNode" id="BBNode_3y70b"] [sub_resource type="BBNode" id="BBNode_3y70b"]
saved_value = NodePath("AnimationPlayer") saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer" resource_name = "AnimationPlayer"
@ -51,13 +33,13 @@ script = ExtResource("2_31fsn")
target_position_var = "pos" target_position_var = "pos"
speed_var = "speed" speed_var = "speed"
tolerance = 50.0 tolerance = 50.0
avoid_var = ""
[sub_resource type="BTSequence" id="BTSequence_k184c"] [sub_resource type="BTSequence" id="BTSequence_k184c"]
custom_name = "Chaotic Walk" custom_name = "Chaotic Walk"
children = [SubResource("BTPlayAnimation_klk26"), SubResource("BTAction_chmiy"), SubResource("BTAction_5kivl")] children = [SubResource("BTPlayAnimation_klk26"), SubResource("BTAction_chmiy"), SubResource("BTAction_5kivl")]
[sub_resource type="BTProbability" id="BTProbability_ifsry"] [sub_resource type="BTProbability" id="BTProbability_ifsry"]
run_chance = 0.6
children = [SubResource("BTSequence_k184c")] children = [SubResource("BTSequence_k184c")]
[sub_resource type="BBNode" id="BBNode_nrd4b"] [sub_resource type="BBNode" id="BBNode_nrd4b"]
@ -70,10 +52,10 @@ animation_name = &"idle"
blend = 0.1 blend = 0.1
[sub_resource type="BTRandomWait" id="BTRandomWait_xlud8"] [sub_resource type="BTRandomWait" id="BTRandomWait_xlud8"]
min_duration = 0.5 min_duration = 0.7
max_duration = 1.5 max_duration = 1.5
[sub_resource type="BTSequence" id="BTSequence_yhjh1"] [sub_resource type="BTSequence" id="BTSequence_n5ltc"]
custom_name = "Pause before action" custom_name = "Pause before action"
children = [SubResource("BTPlayAnimation_qiw21"), SubResource("BTRandomWait_xlud8")] children = [SubResource("BTPlayAnimation_qiw21"), SubResource("BTRandomWait_xlud8")]
@ -127,10 +109,10 @@ children = [SubResource("BTAction_kidxn"), SubResource("BTWait_tadkc"), SubResou
[sub_resource type="BTSequence" id="BTSequence_pxl2k"] [sub_resource type="BTSequence" id="BTSequence_pxl2k"]
custom_name = "Engage player" custom_name = "Engage player"
children = [SubResource("BTSequence_yhjh1"), SubResource("BTSequence_1xfnq"), SubResource("BTSequence_ww5v2")] children = [SubResource("BTSequence_n5ltc"), SubResource("BTSequence_1xfnq"), SubResource("BTSequence_ww5v2")]
[sub_resource type="BTSelector" id="BTSelector_y3llm"] [sub_resource type="BTSelector" id="BTSelector_y3llm"]
children = [SubResource("BTCooldown_u2lrv"), SubResource("BTProbability_ifsry"), SubResource("BTSequence_pxl2k")] children = [SubResource("BTProbability_ifsry"), SubResource("BTSequence_pxl2k")]
[resource] [resource]
blackboard_plan = SubResource("BlackboardPlan_46tbn") blackboard_plan = SubResource("BlackboardPlan_46tbn")

View File

@ -1,7 +1,8 @@
[gd_resource type="BehaviorTree" load_steps=39 format=3 uid="uid://qqmjvbeibatn"] [gd_resource type="BehaviorTree" load_steps=44 format=3 uid="uid://qqmjvbeibatn"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_2883n"] [ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_2883n"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_cjso2"] [ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_cjso2"]
[ext_resource type="Script" path="res://demo/ai/tasks/pursue.gd" id="2_lpckh"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_treio"] [ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_treio"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="4_57x51"] [ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="4_57x51"]
[ext_resource type="Script" path="res://demo/ai/tasks/in_range.gd" id="5_p5dih"] [ext_resource type="Script" path="res://demo/ai/tasks/in_range.gd" id="5_p5dih"]
@ -34,6 +35,7 @@ animation_name = &"idle"
blend = 0.1 blend = 0.1
[sub_resource type="BTRandomWait" id="BTRandomWait_xlud8"] [sub_resource type="BTRandomWait" id="BTRandomWait_xlud8"]
min_duration = 2.0
max_duration = 3.0 max_duration = 3.0
[sub_resource type="BTSequence" id="BTSequence_yhjh1"] [sub_resource type="BTSequence" id="BTSequence_yhjh1"]
@ -46,28 +48,51 @@ children = [SubResource("BTSequence_yhjh1")]
[sub_resource type="BTCondition" id="BTCondition_uk4dg"] [sub_resource type="BTCondition" id="BTCondition_uk4dg"]
script = ExtResource("5_p5dih") script = ExtResource("5_p5dih")
distance_min = 0.0 distance_min = 0.0
distance_max = 170.0 distance_max = 300.0
target_var = "target" target_var = "target"
[sub_resource type="BBNode" id="BBNode_7c0g0"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_sty80"]
animation_player = SubResource("BBNode_7c0g0")
animation_name = &"walk"
blend = 0.1
speed = 1.2
[sub_resource type="BTAction" id="BTAction_jryg6"]
script = ExtResource("2_lpckh")
target_var = "target"
speed_var = "speed"
approach_distance = 100.0
[sub_resource type="BTTimeLimit" id="BTTimeLimit_lkphr"]
time_limit = 1.0
children = [SubResource("BTAction_jryg6")]
[sub_resource type="BTAction" id="BTAction_kidxn"] [sub_resource type="BTAction" id="BTAction_kidxn"]
script = ExtResource("4_57x51") script = ExtResource("4_57x51")
target_var = "target" target_var = "target"
[sub_resource type="BTWait" id="BTWait_tadkc"] [sub_resource type="BTWait" id="BTWait_tadkc"]
duration = 0.1 duration = 0.2
[sub_resource type="BBNode" id="BBNode_s8evu"] [sub_resource type="BBNode" id="BBNode_kcqly"]
saved_value = NodePath("AnimationPlayer") saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer" resource_name = "AnimationPlayer"
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_ppmxd"] [sub_resource type="BTPlayAnimation" id="BTPlayAnimation_hngi6"]
await_completion = 2.0 await_completion = 2.0
animation_player = SubResource("BBNode_s8evu") animation_player = SubResource("BBNode_kcqly")
animation_name = &"attack_3" animation_name = &"attack_3"
[sub_resource type="BTWait" id="BTWait_cm8jy"]
duration = 0.5
[sub_resource type="BTSequence" id="BTSequence_ww5v2"] [sub_resource type="BTSequence" id="BTSequence_ww5v2"]
custom_name = "Melee attack" custom_name = "Melee attack"
children = [SubResource("BTCondition_uk4dg"), SubResource("BTAction_kidxn"), SubResource("BTWait_tadkc"), SubResource("BTPlayAnimation_ppmxd")] children = [SubResource("BTCondition_uk4dg"), SubResource("BTPlayAnimation_sty80"), SubResource("BTTimeLimit_lkphr"), SubResource("BTAction_kidxn"), SubResource("BTWait_tadkc"), SubResource("BTPlayAnimation_hngi6"), SubResource("BTWait_cm8jy")]
[sub_resource type="BTCooldown" id="BTCooldown_ksvfy"] [sub_resource type="BTCooldown" id="BTCooldown_ksvfy"]
duration = 2.0 duration = 2.0
@ -76,7 +101,7 @@ children = [SubResource("BTSequence_ww5v2")]
[sub_resource type="BTCondition" id="BTCondition_fpufi"] [sub_resource type="BTCondition" id="BTCondition_fpufi"]
script = ExtResource("5_p5dih") script = ExtResource("5_p5dih")
distance_min = 0.0 distance_min = 0.0
distance_max = 250.0 distance_max = 300.0
target_var = "target" target_var = "target"
[sub_resource type="BBNode" id="BBNode_3iqcf"] [sub_resource type="BBNode" id="BBNode_3iqcf"]
@ -112,13 +137,9 @@ blend = 0.1
[sub_resource type="BTRandomWait" id="BTRandomWait_jw0cm"] [sub_resource type="BTRandomWait" id="BTRandomWait_jw0cm"]
[sub_resource type="BTSequence" id="BTSequence_bhacl"]
custom_name = "Chill"
children = [SubResource("BTPlayAnimation_e61er"), SubResource("BTRandomWait_jw0cm")]
[sub_resource type="BTSequence" id="BTSequence_y12eg"] [sub_resource type="BTSequence" id="BTSequence_y12eg"]
custom_name = "Back away" custom_name = "Disengage"
children = [SubResource("BTCondition_fpufi"), SubResource("BTPlayAnimation_ee0ff"), SubResource("BTAlwaysSucceed_nw4ep"), SubResource("BTSequence_bhacl")] children = [SubResource("BTCondition_fpufi"), SubResource("BTPlayAnimation_ee0ff"), SubResource("BTAlwaysSucceed_nw4ep"), SubResource("BTPlayAnimation_e61er"), SubResource("BTRandomWait_jw0cm")]
[sub_resource type="BBNode" id="BBNode_wpj6d"] [sub_resource type="BBNode" id="BBNode_wpj6d"]
saved_value = NodePath("AnimationPlayer") saved_value = NodePath("AnimationPlayer")
@ -139,8 +160,8 @@ output_var = "target"
script = ExtResource("2_cjso2") script = ExtResource("2_cjso2")
target_var = "target" target_var = "target"
flank_side = 2 flank_side = 2
range_min = 100 range_min = 90
range_max = 100 range_max = 90
position_var = "flank_pos" position_var = "flank_pos"
[sub_resource type="BTAction" id="BTAction_tv4lt"] [sub_resource type="BTAction" id="BTAction_tv4lt"]
@ -148,13 +169,13 @@ script = ExtResource("3_treio")
target_position_var = "flank_pos" target_position_var = "flank_pos"
speed_var = "fast_speed" speed_var = "fast_speed"
tolerance = 50.0 tolerance = 50.0
avoid_var = "target"
[sub_resource type="BTTimeLimit" id="BTTimeLimit_xek5v"] [sub_resource type="BTTimeLimit" id="BTTimeLimit_xek5v"]
time_limit = 4.0
children = [SubResource("BTAction_tv4lt")] children = [SubResource("BTAction_tv4lt")]
[sub_resource type="BTSequence" id="BTSequence_rgwic"] [sub_resource type="BTSequence" id="BTSequence_rgwic"]
custom_name = "Skirmish" custom_name = "Flank from behind"
children = [SubResource("BTPlayAnimation_olf37"), SubResource("BTAction_ulbrf"), SubResource("BTAction_g5ayy"), SubResource("BTTimeLimit_xek5v")] children = [SubResource("BTPlayAnimation_olf37"), SubResource("BTAction_ulbrf"), SubResource("BTAction_g5ayy"), SubResource("BTTimeLimit_xek5v")]
[sub_resource type="BTSelector" id="BTSelector_2jnau"] [sub_resource type="BTSelector" id="BTSelector_2jnau"]

View File

@ -1,7 +1,7 @@
[gd_resource type="BehaviorTree" load_steps=40 format=3 uid="uid://cqluon1y1hnn5"] [gd_resource type="BehaviorTree" load_steps=41 format=3 uid="uid://cqluon1y1hnn5"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_4xk1i"] [ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_4xk1i"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_random_nearby_pos.gd" id="2_647kx"] [ext_resource type="Script" path="res://demo/ai/tasks/is_aligned_with_target.gd" id="2_a8qex"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_q4r2p"] [ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="3_q4r2p"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="4_53hao"] [ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="4_53hao"]
[ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="5_aexyq"] [ext_resource type="Script" path="res://demo/ai/tasks/face_target.gd" id="5_aexyq"]
@ -12,6 +12,11 @@ var/speed/type = 3
var/speed/value = 400.0 var/speed/value = 400.0
var/speed/hint = 1 var/speed/hint = 1
var/speed/hint_string = "10,1000,10" var/speed/hint_string = "10,1000,10"
var/run_speed/name = "run_speed"
var/run_speed/type = 3
var/run_speed/value = 600.0
var/run_speed/hint = 1
var/run_speed/hint_string = "10,1000,10"
[sub_resource type="BBNode" id="BBNode_nrd4b"] [sub_resource type="BBNode" id="BBNode_nrd4b"]
saved_value = NodePath("AnimationPlayer") saved_value = NodePath("AnimationPlayer")
@ -23,8 +28,8 @@ animation_name = &"idle"
blend = 0.1 blend = 0.1
[sub_resource type="BTRandomWait" id="BTRandomWait_xlud8"] [sub_resource type="BTRandomWait" id="BTRandomWait_xlud8"]
min_duration = 1.2 min_duration = 0.7
max_duration = 2.5 max_duration = 1.5
[sub_resource type="BTAction" id="BTAction_c4cxo"] [sub_resource type="BTAction" id="BTAction_c4cxo"]
script = ExtResource("1_4xk1i") script = ExtResource("1_4xk1i")
@ -35,15 +40,6 @@ output_var = "target"
custom_name = "Take a break" custom_name = "Take a break"
children = [SubResource("BTPlayAnimation_qiw21"), SubResource("BTRandomWait_xlud8"), SubResource("BTAction_c4cxo")] children = [SubResource("BTPlayAnimation_qiw21"), SubResource("BTRandomWait_xlud8"), SubResource("BTAction_c4cxo")]
[sub_resource type="BTComment" id="BTComment_qhsko"]
custom_name = "He is bored attacking player all the time ;)"
[sub_resource type="BTAction" id="BTAction_lpk67"]
script = ExtResource("2_647kx")
range_min = 300.0
range_max = 500.0
position_var = "pos"
[sub_resource type="BBNode" id="BBNode_ok0r5"] [sub_resource type="BBNode" id="BBNode_ok0r5"]
saved_value = NodePath("AnimationPlayer") saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer" resource_name = "AnimationPlayer"
@ -52,25 +48,43 @@ resource_name = "AnimationPlayer"
animation_player = SubResource("BBNode_ok0r5") animation_player = SubResource("BBNode_ok0r5")
animation_name = &"walk" animation_name = &"walk"
blend = 0.1 blend = 0.1
speed = 1.5
[sub_resource type="BTAction" id="BTAction_apfsn"] [sub_resource type="BTAction" id="BTAction_op6l6"]
script = ExtResource("4_53hao")
target_var = "target"
flank_side = 1
range_min = 400
range_max = 1000
position_var = "pos"
[sub_resource type="BTAction" id="BTAction_ycjun"]
script = ExtResource("3_q4r2p") script = ExtResource("3_q4r2p")
target_position_var = "pos" target_position_var = "pos"
speed_var = "speed" speed_var = "run_speed"
tolerance = 50.0 tolerance = 50.0
avoid_var = "target"
[sub_resource type="BTTimeLimit" id="BTTimeLimit_baob7"] [sub_resource type="BTTimeLimit" id="BTTimeLimit_gadc6"]
time_limit = 3.0 time_limit = 7.0
children = [SubResource("BTAction_apfsn")] children = [SubResource("BTAction_ycjun")]
[sub_resource type="BTAction" id="BTAction_poqpu"]
script = ExtResource("5_aexyq")
target_var = "target"
[sub_resource type="BTSequence" id="BTSequence_0gdqn"] [sub_resource type="BTSequence" id="BTSequence_0gdqn"]
custom_name = "Random Walk" custom_name = "Change flank"
children = [SubResource("BTComment_qhsko"), SubResource("BTAction_lpk67"), SubResource("BTPlayAnimation_unftu"), SubResource("BTTimeLimit_baob7")] children = [SubResource("BTPlayAnimation_unftu"), SubResource("BTAction_op6l6"), SubResource("BTTimeLimit_gadc6"), SubResource("BTAction_poqpu")]
[sub_resource type="BTProbability" id="BTProbability_sat88"] [sub_resource type="BTCooldown" id="BTCooldown_2lneu"]
run_chance = 0.3 duration = 7.0
children = [SubResource("BTSequence_0gdqn")] children = [SubResource("BTSequence_0gdqn")]
[sub_resource type="BTProbability" id="BTProbability_6sydk"]
run_chance = 0.3
children = [SubResource("BTCooldown_2lneu")]
[sub_resource type="BTAction" id="BTAction_kuuw2"] [sub_resource type="BTAction" id="BTAction_kuuw2"]
script = ExtResource("4_53hao") script = ExtResource("4_53hao")
target_var = "target" target_var = "target"
@ -93,6 +107,7 @@ script = ExtResource("3_q4r2p")
target_position_var = "shoot_pos" target_position_var = "shoot_pos"
speed_var = "speed" speed_var = "speed"
tolerance = 50.0 tolerance = 50.0
avoid_var = ""
[sub_resource type="BTTimeLimit" id="BTTimeLimit_24ath"] [sub_resource type="BTTimeLimit" id="BTTimeLimit_24ath"]
children = [SubResource("BTAction_66hsk")] children = [SubResource("BTAction_66hsk")]
@ -101,10 +116,10 @@ children = [SubResource("BTAction_66hsk")]
script = ExtResource("5_aexyq") script = ExtResource("5_aexyq")
target_var = "target" target_var = "target"
[sub_resource type="BTSequence" id="BTSequence_lhg7f"] [sub_resource type="BTCondition" id="BTCondition_1fnyc"]
custom_name = "Get into position" script = ExtResource("2_a8qex")
children = [SubResource("BTAction_kuuw2"), SubResource("BTPlayAnimation_panch"), SubResource("BTTimeLimit_24ath"), SubResource("BTAction_enw2m")] target_var = "target"
metadata/_weight_ = 1.0 tolerance = 150.0
[sub_resource type="BBNode" id="BBNode_s6vt4"] [sub_resource type="BBNode" id="BBNode_s6vt4"]
saved_value = NodePath("AnimationPlayer") saved_value = NodePath("AnimationPlayer")
@ -147,12 +162,13 @@ metadata/_weight_ = 1.0
times = 3 times = 3
children = [SubResource("BTSequence_rgbq3")] children = [SubResource("BTSequence_rgbq3")]
[sub_resource type="BTSequence" id="BTSequence_h2tm0"] [sub_resource type="BTSequence" id="BTSequence_lhg7f"]
custom_name = "Align and shoot" custom_name = "Get into position"
children = [SubResource("BTSequence_lhg7f"), SubResource("BTRepeat_g08ia")] children = [SubResource("BTAction_kuuw2"), SubResource("BTPlayAnimation_panch"), SubResource("BTTimeLimit_24ath"), SubResource("BTAction_enw2m"), SubResource("BTCondition_1fnyc"), SubResource("BTRepeat_g08ia")]
metadata/_weight_ = 1.0
[sub_resource type="BTSelector" id="BTSelector_1rrya"] [sub_resource type="BTSelector" id="BTSelector_1rrya"]
children = [SubResource("BTProbability_sat88"), SubResource("BTSequence_h2tm0")] children = [SubResource("BTProbability_6sydk"), SubResource("BTSequence_lhg7f")]
[sub_resource type="BTSequence" id="BTSequence_pxl2k"] [sub_resource type="BTSequence" id="BTSequence_pxl2k"]
custom_name = "Main" custom_name = "Main"

View File

@ -1,4 +1,4 @@
[gd_resource type="BehaviorTree" load_steps=37 format=3 uid="uid://cpncl1db8j12f"] [gd_resource type="BehaviorTree" load_steps=39 format=3 uid="uid://cpncl1db8j12f"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_sf4l8"] [ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_sf4l8"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_5nwkp"] [ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_5nwkp"]
@ -62,6 +62,7 @@ script = ExtResource("3_3tom2")
target_position_var = "pos" target_position_var = "pos"
speed_var = "speed" speed_var = "speed"
tolerance = 50.0 tolerance = 50.0
avoid_var = ""
[sub_resource type="BTTimeLimit" id="BTTimeLimit_xek5v"] [sub_resource type="BTTimeLimit" id="BTTimeLimit_xek5v"]
children = [SubResource("BTAction_ygjnc")] children = [SubResource("BTAction_ygjnc")]
@ -74,8 +75,17 @@ children = [SubResource("BTAction_85keo"), SubResource("BTPlayAnimation_olf37"),
script = ExtResource("4_hi228") script = ExtResource("4_hi228")
target_var = "target" target_var = "target"
[sub_resource type="BBNode" id="BBNode_giv5l"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_usdja"]
animation_player = SubResource("BBNode_giv5l")
animation_name = &"idle"
blend = 0.1
[sub_resource type="BTWait" id="BTWait_tadkc"] [sub_resource type="BTWait" id="BTWait_tadkc"]
duration = 0.2 duration = 0.4
[sub_resource type="BBNode" id="BBNode_s8evu"] [sub_resource type="BBNode" id="BBNode_s8evu"]
saved_value = NodePath("AnimationPlayer") saved_value = NodePath("AnimationPlayer")
@ -142,7 +152,7 @@ duration = 0.5
[sub_resource type="BTSequence" id="BTSequence_ww5v2"] [sub_resource type="BTSequence" id="BTSequence_ww5v2"]
custom_name = "Combo Melee attack" custom_name = "Combo Melee attack"
children = [SubResource("BTAction_kidxn"), SubResource("BTWait_tadkc"), SubResource("BTParallel_ec2e3"), SubResource("BTWait_c0lo0"), SubResource("BTParallel_thojy"), SubResource("BTWait_y3pmv"), SubResource("BTParallel_qmdfb"), SubResource("BTWait_nxyko")] children = [SubResource("BTAction_kidxn"), SubResource("BTPlayAnimation_usdja"), SubResource("BTWait_tadkc"), SubResource("BTParallel_ec2e3"), SubResource("BTWait_c0lo0"), SubResource("BTParallel_thojy"), SubResource("BTWait_y3pmv"), SubResource("BTParallel_qmdfb"), SubResource("BTWait_nxyko")]
[sub_resource type="BTSequence" id="BTSequence_pxl2k"] [sub_resource type="BTSequence" id="BTSequence_pxl2k"]
children = [SubResource("BTSequence_yhjh1"), SubResource("BTSequence_1xfnq"), SubResource("BTSequence_ww5v2")] children = [SubResource("BTSequence_yhjh1"), SubResource("BTSequence_1xfnq"), SubResource("BTSequence_ww5v2")]

View File

@ -1,4 +1,4 @@
[gd_resource type="BehaviorTree" load_steps=46 format=3 uid="uid://c2u6sljqkim0n"] [gd_resource type="BehaviorTree" load_steps=49 format=3 uid="uid://c2u6sljqkim0n"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_08fik"] [ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_08fik"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_te3yo"] [ext_resource type="Script" path="res://demo/ai/tasks/select_flanking_pos.gd" id="2_te3yo"]
@ -28,6 +28,8 @@ animation_name = &"idle"
blend = 0.1 blend = 0.1
[sub_resource type="BTRandomWait" id="BTRandomWait_xlud8"] [sub_resource type="BTRandomWait" id="BTRandomWait_xlud8"]
min_duration = 0.7
max_duration = 1.5
[sub_resource type="BTAction" id="BTAction_c4cxo"] [sub_resource type="BTAction" id="BTAction_c4cxo"]
script = ExtResource("1_08fik") script = ExtResource("1_08fik")
@ -61,6 +63,7 @@ script = ExtResource("3_svwk8")
target_position_var = "flank_pos" target_position_var = "flank_pos"
speed_var = "flank_speed" speed_var = "flank_speed"
tolerance = 50.0 tolerance = 50.0
avoid_var = "target"
[sub_resource type="BTTimeLimit" id="BTTimeLimit_24ath"] [sub_resource type="BTTimeLimit" id="BTTimeLimit_24ath"]
children = [SubResource("BTAction_66hsk")] children = [SubResource("BTAction_66hsk")]
@ -105,18 +108,30 @@ target_var = "target"
[sub_resource type="BTWait" id="BTWait_tadkc"] [sub_resource type="BTWait" id="BTWait_tadkc"]
duration = 0.1 duration = 0.1
[sub_resource type="BBNode" id="BBNode_s8evu"] [sub_resource type="BBNode" id="BBNode_g8qww"]
saved_value = NodePath("AnimationPlayer") saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer" resource_name = "AnimationPlayer"
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_ppmxd"] [sub_resource type="BTPlayAnimation" id="BTPlayAnimation_a8yqu"]
await_completion = 2.0 await_completion = 2.0
animation_player = SubResource("BBNode_s8evu") animation_player = SubResource("BBNode_g8qww")
animation_name = &"attack_2"
[sub_resource type="BTWait" id="BTWait_vjstl"]
duration = 0.1
[sub_resource type="BBNode" id="BBNode_rfop0"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_8oyw6"]
await_completion = 2.0
animation_player = SubResource("BBNode_rfop0")
animation_name = &"attack_3" animation_name = &"attack_3"
[sub_resource type="BTSequence" id="BTSequence_1xfnq"] [sub_resource type="BTSequence" id="BTSequence_1xfnq"]
custom_name = "Approach and melee attack" custom_name = "Approach and melee attack"
children = [SubResource("BTPlayAnimation_olf37"), SubResource("BTTimeLimit_xek5v"), SubResource("BTAction_kidxn"), SubResource("BTWait_tadkc"), SubResource("BTPlayAnimation_ppmxd")] children = [SubResource("BTPlayAnimation_olf37"), SubResource("BTTimeLimit_xek5v"), SubResource("BTAction_kidxn"), SubResource("BTWait_tadkc"), SubResource("BTPlayAnimation_a8yqu"), SubResource("BTWait_vjstl"), SubResource("BTPlayAnimation_8oyw6")]
metadata/_weight_ = 4.0 metadata/_weight_ = 4.0
[sub_resource type="BTAction" id="BTAction_mf87t"] [sub_resource type="BTAction" id="BTAction_mf87t"]
@ -141,6 +156,7 @@ script = ExtResource("3_svwk8")
target_position_var = "pos" target_position_var = "pos"
speed_var = "speed" speed_var = "speed"
tolerance = 50.0 tolerance = 50.0
avoid_var = ""
[sub_resource type="BTTimeLimit" id="BTTimeLimit_tidwl"] [sub_resource type="BTTimeLimit" id="BTTimeLimit_tidwl"]
time_limit = 3.0 time_limit = 3.0

View File

@ -24,6 +24,7 @@ animation_name = &"idle"
blend = 0.1 blend = 0.1
[sub_resource type="BTRandomWait" id="BTRandomWait_j6cjm"] [sub_resource type="BTRandomWait" id="BTRandomWait_j6cjm"]
min_duration = 2.0
max_duration = 3.0 max_duration = 3.0
[sub_resource type="BTSequence" id="BTSequence_5thv4"] [sub_resource type="BTSequence" id="BTSequence_5thv4"]
@ -125,6 +126,7 @@ script = ExtResource("6_0pfsl")
target_position_var = "pos" target_position_var = "pos"
speed_var = "speed" speed_var = "speed"
tolerance = 50.0 tolerance = 50.0
avoid_var = ""
[sub_resource type="BTTimeLimit" id="BTTimeLimit_jyks2"] [sub_resource type="BTTimeLimit" id="BTTimeLimit_jyks2"]
children = [SubResource("BTAction_vb5c3")] children = [SubResource("BTAction_vb5c3")]
@ -170,7 +172,7 @@ node = SubResource("BBNode_dv5b5")
method = &"spit_fire" method = &"spit_fire"
[sub_resource type="BTComment" id="BTComment_fndxk"] [sub_resource type="BTComment" id="BTComment_fndxk"]
custom_name = "Short break after" custom_name = "Wind down"
[sub_resource type="BBNode" id="BBNode_m68ui"] [sub_resource type="BBNode" id="BBNode_m68ui"]
saved_value = NodePath("AnimationPlayer") saved_value = NodePath("AnimationPlayer")
@ -182,7 +184,7 @@ animation_name = &"idle"
blend = 0.1 blend = 0.1
[sub_resource type="BTRandomWait" id="BTRandomWait_v0el8"] [sub_resource type="BTRandomWait" id="BTRandomWait_v0el8"]
min_duration = 0.5 min_duration = 0.7
max_duration = 1.5 max_duration = 1.5
[sub_resource type="BTSequence" id="BTSequence_djtph"] [sub_resource type="BTSequence" id="BTSequence_djtph"]

View File

@ -1,4 +1,4 @@
[gd_resource type="BehaviorTree" load_steps=33 format=3 uid="uid://cpxk7jnqpwwlc"] [gd_resource type="BehaviorTree" load_steps=35 format=3 uid="uid://cpxk7jnqpwwlc"]
[ext_resource type="Script" path="res://demo/ai/tasks/select_random_nearby_pos.gd" id="1_sgn0p"] [ext_resource type="Script" path="res://demo/ai/tasks/select_random_nearby_pos.gd" id="1_sgn0p"]
[ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="2_pshl2"] [ext_resource type="Script" path="res://demo/ai/tasks/arrive_pos.gd" id="2_pshl2"]
@ -33,6 +33,16 @@ children = [SubResource("BTPlayAnimation_sot6a"), SubResource("BTRandomWait_0wc6
[sub_resource type="BTRunLimit" id="BTRunLimit_x2jr4"] [sub_resource type="BTRunLimit" id="BTRunLimit_x2jr4"]
children = [SubResource("BTSequence_kwkxc")] children = [SubResource("BTSequence_kwkxc")]
[sub_resource type="BBVariant" id="BBVariant_y3x7n"]
type = 2
saved_value = 6
resource_name = "6"
[sub_resource type="BTCheckAgentProperty" id="BTCheckAgentProperty_olmdj"]
property = &"summon_count"
check_type = 1
value = SubResource("BBVariant_y3x7n")
[sub_resource type="BTComment" id="BTComment_ef6y0"] [sub_resource type="BTComment" id="BTComment_ef6y0"]
custom_name = "Variable $summon_cooldown is updated by the Cooldown task below" custom_name = "Variable $summon_cooldown is updated by the Cooldown task below"
@ -85,11 +95,10 @@ cooldown_state_var = "summon_cooldown"
children = [SubResource("BTCallMethod_4ath5")] children = [SubResource("BTCallMethod_4ath5")]
[sub_resource type="BTWait" id="BTWait_tdhfn"] [sub_resource type="BTWait" id="BTWait_tdhfn"]
duration = 0.5
[sub_resource type="BTSequence" id="BTSequence_2n742"] [sub_resource type="BTSequence" id="BTSequence_2n742"]
custom_name = "Summon" custom_name = "Summon minion"
children = [SubResource("BTCheckVar_hc3o3"), SubResource("BTPlayAnimation_6leni"), SubResource("BTWait_8og18"), SubResource("BTAction_yeyns"), SubResource("BTCooldown_25f70"), SubResource("BTWait_tdhfn")] children = [SubResource("BTCheckAgentProperty_olmdj"), SubResource("BTCheckVar_hc3o3"), SubResource("BTPlayAnimation_6leni"), SubResource("BTWait_8og18"), SubResource("BTAction_yeyns"), SubResource("BTCooldown_25f70"), SubResource("BTWait_tdhfn")]
[sub_resource type="BTAction" id="BTAction_33wje"] [sub_resource type="BTAction" id="BTAction_33wje"]
script = ExtResource("1_sgn0p") script = ExtResource("1_sgn0p")
@ -111,6 +120,7 @@ script = ExtResource("2_pshl2")
target_position_var = "pos" target_position_var = "pos"
speed_var = "speed" speed_var = "speed"
tolerance = 50.0 tolerance = 50.0
avoid_var = ""
[sub_resource type="BTTimeLimit" id="BTTimeLimit_i05cm"] [sub_resource type="BTTimeLimit" id="BTTimeLimit_i05cm"]
time_limit = 3.0 time_limit = 3.0

Binary file not shown.

View File

@ -13,14 +13,13 @@ const Summoner := preload("res://demo/agents/09_agent_summoner.tscn")
const WAVES: Array = [ const WAVES: Array = [
[Simple, Simple, Nuanced], [Simple, Simple, Nuanced],
[Simple, Nuanced, Charger], [Simple, Nuanced, Charger],
[Simple, Simple, Ranged, Nuanced], [Simple, Simple, Simple, Ranged, Nuanced],
[Simple, Simple, Summoner], [Simple, Simple, Summoner],
[Ranged, Skirmisher, Nuanced, Simple], [Ranged, Skirmisher, Nuanced, Simple, Simple],
[Nuanced, Nuanced, Combo, Ranged], [Nuanced, Nuanced, Combo, Ranged, Simple],
[Demon, Charger, Simple, Simple, Skirmisher], [Demon, Charger, Simple, Simple, Simple, Skirmisher],
[Demon, Nuanced, Combo, Demon], [Demon, Demon, Nuanced, Combo],
[Summoner, Ranged, Nuanced, Nuanced, Ranged, Skirmisher], [Summoner, Ranged, Nuanced, Nuanced, Ranged, Skirmisher, Simple],
[Demon, Demon, Summoner, Skirmisher, Nuanced, Nuanced, Combo], [Demon, Demon, Summoner, Skirmisher, Nuanced, Nuanced, Combo],
] ]
@ -38,11 +37,9 @@ func _ready() -> void:
hp_bar.max_value = player.get_health().max_health hp_bar.max_value = player.get_health().max_health
player.get_health().damaged.connect(func(_a,_b): hp_bar.value = player.get_health().get_current()) player.get_health().damaged.connect(func(_a,_b): hp_bar.value = player.get_health().get_current())
player.death.connect(_on_player_death) player.death.connect(_on_player_death)
round_counter.hide()
func _update_round_counter() -> void: func _update_round_counter() -> void:
round_counter.show()
round_counter.text = "Round %s/%s" % [wave_index + 1, WAVES.size()] round_counter.text = "Round %s/%s" % [wave_index + 1, WAVES.size()]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=3 uid="uid://clyhgbpfpmtw7"] [gd_scene load_steps=14 format=3 uid="uid://clyhgbpfpmtw7"]
[ext_resource type="Script" path="res://demo/scenes/game.gd" id="1_qw71e"] [ext_resource type="Script" path="res://demo/scenes/game.gd" id="1_qw71e"]
[ext_resource type="Theme" uid="uid://boqtjf88xcpu4" path="res://demo/assets/ui.theme" id="2_r21q3"] [ext_resource type="Theme" uid="uid://boqtjf88xcpu4" path="res://demo/assets/ui.theme" id="2_r21q3"]
@ -12,6 +12,12 @@
[ext_resource type="PackedScene" uid="uid://bpd1wmw2f7bvg" path="res://demo/props/gong.tscn" id="10_tftjb"] [ext_resource type="PackedScene" uid="uid://bpd1wmw2f7bvg" path="res://demo/props/gong.tscn" id="10_tftjb"]
[ext_resource type="PackedScene" uid="uid://d07ag5dcje13i" path="res://demo/agents/player/player.tscn" id="11_bndob"] [ext_resource type="PackedScene" uid="uid://d07ag5dcje13i" path="res://demo/agents/player/player.tscn" id="11_bndob"]
[sub_resource type="LabelSettings" id="LabelSettings_qvxvp"]
font = ExtResource("4_w0vii")
font_size = 33
outline_size = 11
outline_color = Color(0.258915, 0.234974, 0.191974, 1)
[sub_resource type="LabelSettings" id="LabelSettings_628x3"] [sub_resource type="LabelSettings" id="LabelSettings_628x3"]
font = ExtResource("4_w0vii") font = ExtResource("4_w0vii")
font_size = 36 font_size = 36
@ -19,19 +25,7 @@ font_color = Color(1, 1, 0.239216, 1)
outline_size = 20 outline_size = 20
outline_color = Color(0.211521, 0.23888, 0.290166, 1) outline_color = Color(0.211521, 0.23888, 0.290166, 1)
[sub_resource type="LabelSettings" id="LabelSettings_0r6iv"] [node name="Game" type="Node2D"]
font = ExtResource("4_w0vii")
font_size = 37
outline_size = 15
outline_color = Color(0.211521, 0.23888, 0.290166, 1)
[sub_resource type="LabelSettings" id="LabelSettings_qvxvp"]
font = ExtResource("4_w0vii")
font_size = 33
outline_size = 11
outline_color = Color(0.258915, 0.234974, 0.191974, 1)
[node name="Demo" type="Node2D"]
y_sort_enabled = true y_sort_enabled = true
script = ExtResource("1_qw71e") script = ExtResource("1_qw71e")
@ -46,6 +40,49 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme = ExtResource("2_r21q3") theme = ExtResource("2_r21q3")
[node name="Toolbar" type="PanelContainer" parent="UI Layer/Control"]
custom_minimum_size = Vector2(0, 54.26)
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 64.0
grow_horizontal = 2
[node name="HBoxContainer" type="HBoxContainer" parent="UI Layer/Control/Toolbar"]
layout_mode = 2
theme_override_constants/separation = 4
[node name="ToggleFullscreen" type="Button" parent="UI Layer/Control/Toolbar/HBoxContainer"]
layout_mode = 2
focus_mode = 0
theme_override_fonts/font = ExtResource("4_w0vii")
theme_override_font_sizes/font_size = 22
text = "Toggle Fullscreen"
script = ExtResource("5_m16ov")
[node name="Switch to Showcase" type="Button" parent="UI Layer/Control/Toolbar/HBoxContainer"]
layout_mode = 2
focus_mode = 0
theme_override_fonts/font = ExtResource("4_w0vii")
theme_override_font_sizes/font_size = 22
text = "Switch to Showcase
"
[node name="RoundCounter" type="Label" parent="UI Layer/Control/Toolbar/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 6
text = "Strike the Gong to begin!"
label_settings = SubResource("LabelSettings_qvxvp")
[node name="HPBar" type="TextureProgressBar" parent="UI Layer/Control/Toolbar/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
value = 100.0
texture_under = ExtResource("6_622dk")
texture_over = ExtResource("7_430mt")
texture_progress = ExtResource("8_invih")
[node name="Logo" type="TextureRect" parent="UI Layer/Control"] [node name="Logo" type="TextureRect" parent="UI Layer/Control"]
layout_mode = 1 layout_mode = 1
anchors_preset = 3 anchors_preset = 3
@ -79,73 +116,8 @@ label_settings = SubResource("LabelSettings_628x3")
horizontal_alignment = 2 horizontal_alignment = 2
vertical_alignment = 1 vertical_alignment = 1
[node name="VBoxContainer" type="VBoxContainer" parent="UI Layer/Control"]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -394.0
offset_top = -231.0
offset_right = 99.0
offset_bottom = 39.0
grow_horizontal = 0
grow_vertical = 0
[node name="Controls" type="Label" parent="UI Layer/Control/VBoxContainer"]
layout_mode = 2
text = "Move WASD
Attack ENTER or F
Dodge SPACE"
label_settings = SubResource("LabelSettings_0r6iv")
[node name="HBoxContainer" type="HBoxContainer" parent="UI Layer/Control"]
layout_mode = 0
offset_left = 1512.0
offset_top = 29.0
offset_right = 1912.0
offset_bottom = 74.0
[node name="ToggleFullscreen" type="Button" parent="UI Layer/Control/HBoxContainer"]
layout_mode = 2
focus_mode = 0
theme_override_fonts/font = ExtResource("4_w0vii")
theme_override_font_sizes/font_size = 22
text = "Toggle Fullscreen"
script = ExtResource("5_m16ov")
[node name="Switch to Showcase" type="Button" parent="UI Layer/Control/HBoxContainer"]
layout_mode = 2
focus_mode = 0
theme_override_fonts/font = ExtResource("4_w0vii")
theme_override_font_sizes/font_size = 22
text = "Switch to Showcase
"
[node name="HPBar" type="TextureProgressBar" parent="UI Layer/Control"]
unique_name_in_owner = true
layout_mode = 0
offset_left = 25.0
offset_top = 24.0
offset_right = 405.0
offset_bottom = 84.0
value = 100.0
texture_under = ExtResource("6_622dk")
texture_over = ExtResource("7_430mt")
texture_progress = ExtResource("8_invih")
[node name="RoundCounter" type="Label" parent="UI Layer/Control"]
unique_name_in_owner = true
layout_mode = 1
offset_left = 441.0
offset_top = 29.0
offset_right = 610.0
offset_bottom = 81.0
text = "Round: 0/1"
label_settings = SubResource("LabelSettings_qvxvp")
[node name="Arena" parent="." instance=ExtResource("9_k3uu1")] [node name="Arena" parent="." instance=ExtResource("9_k3uu1")]
metadata/_edit_lock_ = true
[node name="Gong" parent="." instance=ExtResource("10_tftjb")] [node name="Gong" parent="." instance=ExtResource("10_tftjb")]
position = Vector2(923, -21) position = Vector2(923, -21)
@ -154,6 +126,7 @@ position = Vector2(923, -21)
position = Vector2(843, 455) position = Vector2(843, 455)
[node name="Camera2D" type="Camera2D" parent="Player"] [node name="Camera2D" type="Camera2D" parent="Player"]
position = Vector2(0, -100)
zoom = Vector2(0.88, 0.88) zoom = Vector2(0.88, 0.88)
process_callback = 0 process_callback = 0
position_smoothing_enabled = true position_smoothing_enabled = true
@ -194,5 +167,5 @@ position = Vector2(629, 417)
[node name="SpawnPosition10" type="Marker2D" parent="SpawnPoints"] [node name="SpawnPosition10" type="Marker2D" parent="SpawnPoints"]
position = Vector2(1859, 3) position = Vector2(1859, 3)
[connection signal="pressed" from="UI Layer/Control/HBoxContainer/Switch to Showcase" to="." method="_on_switch_to_showcase_pressed"] [connection signal="pressed" from="UI Layer/Control/Toolbar/HBoxContainer/Switch to Showcase" to="." method="_on_switch_to_showcase_pressed"]
[connection signal="gong_struck" from="Gong" to="." method="_on_gong_gong_struck"] [connection signal="gong_struck" from="Gong" to="." method="_on_gong_gong_struck"]

View File

@ -2,7 +2,6 @@ extends Node2D
@onready var behavior_tree_view: BehaviorTreeView = %BehaviorTreeView @onready var behavior_tree_view: BehaviorTreeView = %BehaviorTreeView
@onready var camera: Camera2D = $Camera2D @onready var camera: Camera2D = $Camera2D
@onready var resource_name: Label = %ResourceName
@onready var agent_selection: MenuButton = %AgentSelection @onready var agent_selection: MenuButton = %AgentSelection
@onready var previous: Button = %Previous @onready var previous: Button = %Previous
@onready var next: Button = %Next @onready var next: Button = %Next
@ -68,7 +67,6 @@ func _load_agent(file_name: String) -> void:
add_child(agent) add_child(agent)
bt_player = agent.find_child("BTPlayer") bt_player = agent.find_child("BTPlayer")
_attach_camera(agent) _attach_camera(agent)
resource_name.text = bt_player.behavior_tree.resource_path.get_file()
func _on_agent_selection_id_pressed(id: int) -> void: func _on_agent_selection_id_pressed(id: int) -> void:

View File

@ -11,7 +11,8 @@
[sub_resource type="LabelSettings" id="LabelSettings_3uhve"] [sub_resource type="LabelSettings" id="LabelSettings_3uhve"]
font = ExtResource("3_7vli5") font = ExtResource("3_7vli5")
font_size = 29 font_size = 26
font_color = Color(0.804089, 0.811917, 0.823636, 1)
outline_size = 10 outline_size = 10
outline_color = Color(0.145083, 0.168536, 0.203708, 1) outline_color = Color(0.145083, 0.168536, 0.203708, 1)
@ -38,51 +39,69 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
theme = ExtResource("2_3d7dj") theme = ExtResource("2_3d7dj")
[node name="Panel" type="Panel" parent="UI Layer/Control"] [node name="Toolbar" type="PanelContainer" parent="UI Layer/Control"]
custom_minimum_size = Vector2(600, 0) custom_minimum_size = Vector2(0, 54.26)
layout_mode = 1 layout_mode = 1
anchors_preset = 11 anchors_preset = 10
anchor_left = 1.0
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 offset_right = -612.0
offset_left = -600.0 offset_bottom = 58.0
grow_horizontal = 0 grow_horizontal = 2
grow_vertical = 2
[node name="ClickToSelect" type="Label" parent="UI Layer/Control"] [node name="HBoxContainer" type="HBoxContainer" parent="UI Layer/Control/Toolbar"]
layout_mode = 2
theme_override_constants/separation = 4
[node name="ToggleFullscreen" type="Button" parent="UI Layer/Control/Toolbar/HBoxContainer"]
layout_mode = 2
focus_mode = 0
theme_override_fonts/font = ExtResource("3_7vli5")
theme_override_font_sizes/font_size = 22
text = "Toggle Fullscreen"
script = ExtResource("6_uggpo")
[node name="SwitchToGame" type="Button" parent="UI Layer/Control/Toolbar/HBoxContainer"]
layout_mode = 2
focus_mode = 0
theme_override_fonts/font = ExtResource("3_7vli5")
theme_override_font_sizes/font_size = 22
text = "Switch to Game"
[node name="ClickToSelect" type="Label" parent="UI Layer/Control/Toolbar/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
offset_left = 992.0 size_flags_horizontal = 10
offset_top = -2.0
offset_right = 1305.0
offset_bottom = 52.0
text = "Select Agent ➤" text = "Select Agent ➤"
label_settings = SubResource("LabelSettings_3uhve") label_settings = SubResource("LabelSettings_3uhve")
horizontal_alignment = 2 horizontal_alignment = 2
vertical_alignment = 1
[node name="VBoxContainer" type="VBoxContainer" parent="UI Layer/Control"] [node name="BehaviorInspector" type="PanelContainer" parent="UI Layer/Control"]
custom_minimum_size = Vector2(600, 0)
layout_mode = 1 layout_mode = 1
anchors_preset = 11 anchors_preset = 11
anchor_left = 1.0 anchor_left = 1.0
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_left = -612.0
grow_horizontal = 0 grow_horizontal = 0
grow_vertical = 2 grow_vertical = 2
theme_override_constants/separation = 0
[node name="HBoxContainer" type="HBoxContainer" parent="UI Layer/Control/VBoxContainer"] [node name="VBoxContainer" type="VBoxContainer" parent="UI Layer/Control/BehaviorInspector"]
custom_minimum_size = Vector2(600, 0)
layout_mode = 2 layout_mode = 2
theme_override_constants/separation = 4
[node name="Previous" type="Button" parent="UI Layer/Control/VBoxContainer/HBoxContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="UI Layer/Control/BehaviorInspector/VBoxContainer"]
layout_mode = 2
theme_override_constants/separation = 4
[node name="Previous" type="Button" parent="UI Layer/Control/BehaviorInspector/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
focus_mode = 0 focus_mode = 0
theme_override_font_sizes/font_size = 28 theme_override_font_sizes/font_size = 28
text = "⬅" text = "⬅"
[node name="AgentSelection" type="MenuButton" parent="UI Layer/Control/VBoxContainer/HBoxContainer"] [node name="AgentSelection" type="MenuButton" parent="UI Layer/Control/BehaviorInspector/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
custom_minimum_size = Vector2(400, 50) custom_minimum_size = Vector2(400, 50)
layout_mode = 2 layout_mode = 2
@ -93,23 +112,14 @@ text = "02_agent_imp.tres
" "
flat = false flat = false
[node name="Next" type="Button" parent="UI Layer/Control/VBoxContainer/HBoxContainer"] [node name="Next" type="Button" parent="UI Layer/Control/BehaviorInspector/VBoxContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
focus_mode = 0 focus_mode = 0
theme_override_font_sizes/font_size = 28 theme_override_font_sizes/font_size = 28
text = "➡" text = "➡"
[node name="ResourceName" type="Label" parent="UI Layer/Control/VBoxContainer"] [node name="BehaviorTreeView" type="BehaviorTreeView" parent="UI Layer/Control/BehaviorInspector/VBoxContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
text = "o2_agent_imp.tres"
label_settings = SubResource("LabelSettings_3uhve")
horizontal_alignment = 2
vertical_alignment = 1
[node name="BehaviorTreeView" type="BehaviorTreeView" parent="UI Layer/Control/VBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
custom_minimum_size = Vector2(600, 0) custom_minimum_size = Vector2(600, 0)
layout_mode = 2 layout_mode = 2
@ -148,28 +158,6 @@ label_settings = SubResource("LabelSettings_la4ui")
horizontal_alignment = 2 horizontal_alignment = 2
vertical_alignment = 1 vertical_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="UI Layer/Control"]
layout_mode = 0
offset_left = 8.0
offset_top = 8.0
offset_right = 191.0
offset_bottom = 53.0
[node name="ToggleFullscreen" type="Button" parent="UI Layer/Control/HBoxContainer"]
layout_mode = 2
focus_mode = 0
theme_override_fonts/font = ExtResource("3_7vli5")
theme_override_font_sizes/font_size = 22
text = "Toggle Fullscreen"
script = ExtResource("6_uggpo")
[node name="SwitchToGame" type="Button" parent="UI Layer/Control/HBoxContainer"]
layout_mode = 2
focus_mode = 0
theme_override_fonts/font = ExtResource("3_7vli5")
theme_override_font_sizes/font_size = 22
text = "Switch to Game"
[node name="Camera2D" type="Camera2D" parent="."] [node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(400, 0) position = Vector2(400, 0)
zoom = Vector2(0.88, 0.88) zoom = Vector2(0.88, 0.88)
@ -188,4 +176,4 @@ metadata/_edit_lock_ = true
[node name="Dummy" parent="." instance=ExtResource("8_apshw")] [node name="Dummy" parent="." instance=ExtResource("8_apshw")]
position = Vector2(1106, 423) position = Vector2(1106, 423)
[connection signal="pressed" from="UI Layer/Control/HBoxContainer/SwitchToGame" to="." method="_on_switch_to_game_pressed"] [connection signal="pressed" from="UI Layer/Control/Toolbar/HBoxContainer/SwitchToGame" to="." method="_on_switch_to_game_pressed"]

View File

@ -19,6 +19,7 @@ config/icon="res://demo/icon.svg"
window/size/viewport_width=1920 window/size/viewport_width=1920
window/size/viewport_height=1080 window/size/viewport_height=1080
window/size/mode=3
window/size/window_width_override=1280 window/size/window_width_override=1280
window/size/window_height_override=720 window/size/window_height_override=720
window/stretch/mode="canvas_items" window/stretch/mode="canvas_items"