Demo: Add throwing stars routine to nuanced melee

Also add collisions to gong.
Also don't register hits for enemies from enemies
This commit is contained in:
Serhii Snitsaruk 2024-01-31 22:19:14 +01:00
parent 8bce9cceb7
commit c8ecaf6c8c
14 changed files with 479 additions and 241 deletions

View File

@ -1,9 +1,10 @@
[gd_scene load_steps=29 format=3 uid="uid://ooigbfhfy4wa"] [gd_scene load_steps=30 format=3 uid="uid://ooigbfhfy4wa"]
[ext_resource type="Texture2D" uid="uid://dlo1ine6p5di4" path="res://demo/assets/agent_bobby.png" id="1_1u51b"] [ext_resource type="Texture2D" uid="uid://dlo1ine6p5di4" path="res://demo/assets/agent_bobby.png" id="1_1u51b"]
[ext_resource type="Script" path="res://demo/agents/scripts/agent_base.gd" id="1_n8vy2"] [ext_resource type="Script" path="res://demo/agents/scripts/agent_base.gd" id="1_n8vy2"]
[ext_resource type="Texture2D" uid="uid://dj4oayt5ttvh8" path="res://demo/assets/fx.png" id="2_lv102"] [ext_resource type="Texture2D" uid="uid://dj4oayt5ttvh8" path="res://demo/assets/fx.png" id="2_lv102"]
[ext_resource type="Texture2D" uid="uid://dwhhxj5557qrb" path="res://demo/assets/shadow.png" id="2_vr0jo"] [ext_resource type="Texture2D" uid="uid://dwhhxj5557qrb" path="res://demo/assets/shadow.png" id="2_vr0jo"]
[ext_resource type="Texture2D" uid="uid://2uyxh7sy8qny" path="res://demo/assets/weapon_ninja_star.png" id="4_1c5xq"]
[ext_resource type="Texture2D" uid="uid://bdusy0qqtw0th" path="res://demo/assets/smoke.png" id="4_mnb6v"] [ext_resource type="Texture2D" uid="uid://bdusy0qqtw0th" path="res://demo/assets/smoke.png" id="4_mnb6v"]
[ext_resource type="Script" path="res://demo/agents/scripts/health.gd" id="4_qwtrf"] [ext_resource type="Script" path="res://demo/agents/scripts/health.gd" id="4_qwtrf"]
[ext_resource type="Script" path="res://demo/agents/scripts/hitbox.gd" id="5_taq6b"] [ext_resource type="Script" path="res://demo/agents/scripts/hitbox.gd" id="5_taq6b"]
@ -13,7 +14,7 @@
_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]
point_count = 3 point_count = 3
[sub_resource type="CurveTexture" id="CurveTexture_1f5jp"] [sub_resource type="CurveTexture" id="CurveTexture_sb0wp"]
curve = SubResource("Curve_noh01") curve = SubResource("Curve_noh01")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_f5i1x"] [sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_f5i1x"]
@ -34,7 +35,7 @@ damping_min = 200.0
damping_max = 200.0 damping_max = 200.0
scale_min = 0.8 scale_min = 0.8
scale_max = 1.2 scale_max = 1.2
scale_curve = SubResource("CurveTexture_1f5jp") scale_curve = SubResource("CurveTexture_sb0wp")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2k81i"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_2k81i"]
size = Vector2(100, 35) size = Vector2(100, 35)
@ -42,8 +43,7 @@ size = Vector2(100, 35)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_26abe"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_26abe"]
size = Vector2(70, 35) size = Vector2(70, 35)
[sub_resource type="CircleShape2D" id="CircleShape2D_so8wt"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_aa16q"]
radius = 78.7753
[sub_resource type="Animation" id="Animation_nvm4d"] [sub_resource type="Animation" id="Animation_nvm4d"]
resource_name = "RESET" resource_name = "RESET"
@ -347,6 +347,18 @@ tracks/24/keys = {
"update": 1, "update": 1,
"values": [false] "values": [false]
} }
tracks/25/type = "value"
tracks/25/imported = false
tracks/25/enabled = true
tracks/25/path = NodePath("Root/WeaponNinjaStar:visible")
tracks/25/interp = 1
tracks/25/loop_wrap = true
tracks/25/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"
@ -1680,6 +1692,18 @@ tracks/20/keys = {
"update": 0, "update": 0,
"values": [Color(1, 1, 1, 1), Color(0.721569, 0, 0.0352941, 1), Color(1, 1, 1, 1)] "values": [Color(1, 1, 1, 1), Color(0.721569, 0, 0.0352941, 1), Color(1, 1, 1, 1)]
} }
tracks/21/type = "value"
tracks/21/imported = false
tracks/21/enabled = true
tracks/21/path = NodePath("Root/WeaponNinjaStar:visible")
tracks/21/interp = 1
tracks/21/loop_wrap = true
tracks/21/keys = {
"times": PackedFloat32Array(0, 0.25),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [false, false]
}
[sub_resource type="Animation" id="Animation_gnqgt"] [sub_resource type="Animation" id="Animation_gnqgt"]
resource_name = "idle" resource_name = "idle"
@ -2610,138 +2634,138 @@ tracks/17/keys = {
"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] "values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)]
} }
[sub_resource type="Animation" id="Animation_fh06e"] [sub_resource type="Animation" id="Animation_yn0t6"]
resource_name = "walk" resource_name = "throw"
length = 0.6 length = 0.1
loop_mode = 1 step = 0.01
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/path = NodePath("Root/Rig/Body:position") tracks/0/path = NodePath("Root/Rig:position")
tracks/0/interp = 1 tracks/0/interp = 1
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/keys = { tracks/0/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1),
"update": 0, "update": 0,
"values": [Vector2(5, 53), Vector2(5, 47), Vector2(5, 53)] "values": [Vector2(0, -76)]
} }
tracks/1/type = "value" tracks/1/type = "value"
tracks/1/imported = false tracks/1/imported = false
tracks/1/enabled = true tracks/1/enabled = true
tracks/1/path = NodePath("Root/Rig/Body:rotation") tracks/1/path = NodePath("Root/Rig:rotation")
tracks/1/interp = 1 tracks/1/interp = 1
tracks/1/loop_wrap = true tracks/1/loop_wrap = true
tracks/1/keys = { tracks/1/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1),
"update": 0, "update": 0,
"values": [0.0, 0.0, 0.0] "values": [0.0]
} }
tracks/2/type = "value" tracks/2/type = "value"
tracks/2/imported = false tracks/2/imported = false
tracks/2/enabled = true tracks/2/enabled = true
tracks/2/path = NodePath("Root/Rig/Body:scale") tracks/2/path = NodePath("Root/Rig/LegL:position")
tracks/2/interp = 1 tracks/2/interp = 1
tracks/2/loop_wrap = true tracks/2/loop_wrap = true
tracks/2/keys = { tracks/2/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [Vector2(1, 1), Vector2(0.92, 1.08), Vector2(1, 1)] "values": [Vector2(-48, 64), Vector2(45, 67)]
} }
tracks/3/type = "value" tracks/3/type = "value"
tracks/3/imported = false tracks/3/imported = false
tracks/3/enabled = true tracks/3/enabled = true
tracks/3/path = NodePath("Root/Rig/Body/Hat:position") tracks/3/path = NodePath("Root/Rig/LegL:rotation")
tracks/3/interp = 1 tracks/3/interp = 1
tracks/3/loop_wrap = true tracks/3/loop_wrap = true
tracks/3/keys = { tracks/3/keys = {
"times": PackedFloat32Array(0, 0.6), "times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [Vector2(2, -91), Vector2(2, -91)] "values": [0.862915, -0.786391]
} }
tracks/4/type = "value" tracks/4/type = "value"
tracks/4/imported = false tracks/4/imported = false
tracks/4/enabled = true tracks/4/enabled = true
tracks/4/path = NodePath("Root/Rig/Body/Hat:rotation") tracks/4/path = NodePath("Root/Rig/LegR:position")
tracks/4/interp = 1 tracks/4/interp = 1
tracks/4/loop_wrap = true tracks/4/loop_wrap = true
tracks/4/keys = { tracks/4/keys = {
"times": PackedFloat32Array(0, 0.6), "times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [0.0, 0.0] "values": [Vector2(31, 65), Vector2(-27, 64)]
} }
tracks/5/type = "value" tracks/5/type = "value"
tracks/5/imported = false tracks/5/imported = false
tracks/5/enabled = true tracks/5/enabled = true
tracks/5/path = NodePath("Root/Rig/Body/Hat:scale") tracks/5/path = NodePath("Root/Rig/LegR:rotation")
tracks/5/interp = 1 tracks/5/interp = 1
tracks/5/loop_wrap = true tracks/5/loop_wrap = true
tracks/5/keys = { tracks/5/keys = {
"times": PackedFloat32Array(0, 0.6), "times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [Vector2(1, 1), Vector2(1, 1)] "values": [0.0, 0.899266]
} }
tracks/6/type = "value" tracks/6/type = "value"
tracks/6/imported = false tracks/6/imported = false
tracks/6/enabled = true tracks/6/enabled = true
tracks/6/path = NodePath("Root/Rig/Body/HandL:position") tracks/6/path = NodePath("Root/Rig/Body:position")
tracks/6/interp = 2 tracks/6/interp = 1
tracks/6/loop_wrap = true tracks/6/loop_wrap = true
tracks/6/keys = { tracks/6/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [Vector2(-60, -53), Vector2(17, -22), Vector2(-60, -53)] "values": [Vector2(5, 53), Vector2(5, 53)]
} }
tracks/7/type = "value" tracks/7/type = "value"
tracks/7/imported = false tracks/7/imported = false
tracks/7/enabled = true tracks/7/enabled = true
tracks/7/path = NodePath("Root/Rig/Body/HandL:rotation") tracks/7/path = NodePath("Root/Rig/Body:rotation")
tracks/7/interp = 1 tracks/7/interp = 1
tracks/7/loop_wrap = true tracks/7/loop_wrap = true
tracks/7/keys = { tracks/7/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [0.0, 0.0, 0.0] "values": [-0.250268, 0.250549]
} }
tracks/8/type = "value" tracks/8/type = "value"
tracks/8/imported = false tracks/8/imported = false
tracks/8/enabled = true tracks/8/enabled = true
tracks/8/path = NodePath("Root/Rig/Body/HandL:scale") tracks/8/path = NodePath("Root/Rig/Body/Hat:position")
tracks/8/interp = 1 tracks/8/interp = 1
tracks/8/loop_wrap = true tracks/8/loop_wrap = true
tracks/8/keys = { tracks/8/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1),
"update": 0, "update": 0,
"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] "values": [Vector2(2, -91)]
} }
tracks/9/type = "value" tracks/9/type = "value"
tracks/9/imported = false tracks/9/imported = false
tracks/9/enabled = true tracks/9/enabled = true
tracks/9/path = NodePath("Root/Rig/Body/HandR:position") tracks/9/path = NodePath("Root/Rig/Body/Hat:rotation")
tracks/9/interp = 2 tracks/9/interp = 1
tracks/9/loop_wrap = true tracks/9/loop_wrap = true
tracks/9/keys = { tracks/9/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1),
"update": 0, "update": 0,
"values": [Vector2(51, -51), Vector2(-26, -29), Vector2(51, -51)] "values": [0.0]
} }
tracks/10/type = "value" tracks/10/type = "value"
tracks/10/imported = false tracks/10/imported = false
tracks/10/enabled = true tracks/10/enabled = true
tracks/10/path = NodePath("Root/Rig/Body/HandR:rotation") tracks/10/path = NodePath("Root/Rig/Body/HandL:rotation")
tracks/10/interp = 1 tracks/10/interp = 1
tracks/10/loop_wrap = true tracks/10/loop_wrap = true
tracks/10/keys = { tracks/10/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0, 0.05, 0.1),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [0.0, 0.0, 0.0] "values": [0.0, 0.0, 0.0]
@ -2749,38 +2773,38 @@ tracks/10/keys = {
tracks/11/type = "value" tracks/11/type = "value"
tracks/11/imported = false tracks/11/imported = false
tracks/11/enabled = true tracks/11/enabled = true
tracks/11/path = NodePath("Root/Rig/Body/HandR:scale") tracks/11/path = NodePath("Root/Rig/Body/HandR:position")
tracks/11/interp = 1 tracks/11/interp = 1
tracks/11/loop_wrap = true tracks/11/loop_wrap = true
tracks/11/keys = { tracks/11/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)] "values": [Vector2(37.6892, -51.6964), Vector2(-36.284, -25.5073)]
} }
tracks/12/type = "value" tracks/12/type = "value"
tracks/12/imported = false tracks/12/imported = false
tracks/12/enabled = true tracks/12/enabled = true
tracks/12/path = NodePath("Root/Rig/LegL:position") tracks/12/path = NodePath("Root/Rig/Body/HandR:rotation")
tracks/12/interp = 2 tracks/12/interp = 1
tracks/12/loop_wrap = true tracks/12/loop_wrap = true
tracks/12/keys = { tracks/12/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [Vector2(-29, 65), Vector2(33, 65), Vector2(-29, 65)] "values": [0.0, 0.0]
} }
tracks/13/type = "value" tracks/13/type = "value"
tracks/13/imported = false tracks/13/imported = false
tracks/13/enabled = true tracks/13/enabled = true
tracks/13/path = NodePath("Root/Rig/LegL:rotation") tracks/13/path = NodePath("Root/Rig:scale")
tracks/13/interp = 2 tracks/13/interp = 1
tracks/13/loop_wrap = true tracks/13/loop_wrap = true
tracks/13/keys = { tracks/13/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1),
"update": 0, "update": 0,
"values": [0.0, -0.991068, 0.0] "values": [Vector2(1, 1)]
} }
tracks/14/type = "value" tracks/14/type = "value"
tracks/14/imported = false tracks/14/imported = false
@ -2789,62 +2813,98 @@ tracks/14/path = NodePath("Root/Rig/LegL:scale")
tracks/14/interp = 1 tracks/14/interp = 1
tracks/14/loop_wrap = true tracks/14/loop_wrap = true
tracks/14/keys = { tracks/14/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [Vector2(1.1, 1.1), Vector2(1, 1), Vector2(1.1, 1.1)] "values": [Vector2(1, 1), Vector2(1, 1)]
} }
tracks/15/type = "value" tracks/15/type = "value"
tracks/15/imported = false tracks/15/imported = false
tracks/15/enabled = true tracks/15/enabled = true
tracks/15/path = NodePath("Root/Rig/LegR:position") tracks/15/path = NodePath("Root/Rig/LegR:scale")
tracks/15/interp = 2 tracks/15/interp = 1
tracks/15/loop_wrap = true tracks/15/loop_wrap = true
tracks/15/keys = { tracks/15/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [Vector2(31, 65), Vector2(-30, 65), Vector2(31, 65)] "values": [Vector2(1, 1), Vector2(1, 1)]
} }
tracks/16/type = "value" tracks/16/type = "value"
tracks/16/imported = false tracks/16/imported = false
tracks/16/enabled = true tracks/16/enabled = true
tracks/16/path = NodePath("Root/Rig/LegR:rotation") tracks/16/path = NodePath("Root/Rig/Body:scale")
tracks/16/interp = 2 tracks/16/interp = 1
tracks/16/loop_wrap = true tracks/16/loop_wrap = true
tracks/16/keys = { tracks/16/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [0.0, 1.13756, 0.0] "values": [Vector2(0.9, 1.1), Vector2(1.1, 0.9)]
} }
tracks/17/type = "value" tracks/17/type = "value"
tracks/17/imported = false tracks/17/imported = false
tracks/17/enabled = true tracks/17/enabled = true
tracks/17/path = NodePath("Root/Rig/LegR:scale") tracks/17/path = NodePath("Root/Rig/Body/Hat:scale")
tracks/17/interp = 1 tracks/17/interp = 1
tracks/17/loop_wrap = true tracks/17/loop_wrap = true
tracks/17/keys = { tracks/17/keys = {
"times": PackedFloat32Array(0, 0.3, 0.6), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1),
"update": 0, "update": 0,
"values": [Vector2(1, 1), Vector2(1.1, 1.1), Vector2(1, 1)] "values": [Vector2(1, 1)]
} }
tracks/18/type = "value" tracks/18/type = "value"
tracks/18/imported = false tracks/18/imported = false
tracks/18/enabled = true tracks/18/enabled = true
tracks/18/path = NodePath("Root/FX/Cloud:visible") tracks/18/path = NodePath("Root/Rig/Body/HandL:position")
tracks/18/interp = 1 tracks/18/interp = 1
tracks/18/loop_wrap = true tracks/18/loop_wrap = true
tracks/18/keys = { tracks/18/keys = {
"times": PackedFloat32Array(0), "times": PackedFloat32Array(0, 0.05, 0.1),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Vector2(-70.3036, -52.0327), Vector2(-5.01252, -88.9993), Vector2(66.2323, -78.0635)]
}
tracks/19/type = "value"
tracks/19/imported = false
tracks/19/enabled = true
tracks/19/path = NodePath("Root/Rig/Body/HandL:scale")
tracks/19/interp = 1
tracks/19/loop_wrap = true
tracks/19/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1.5, 1.5)]
}
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),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(1, 1), Vector2(1, 1)]
}
tracks/21/type = "value"
tracks/21/imported = false
tracks/21/enabled = true
tracks/21/path = NodePath("Root/WeaponNinjaStar:visible")
tracks/21/interp = 1
tracks/21/loop_wrap = true
tracks/21/keys = {
"times": PackedFloat32Array(0, 0.09, 0.1),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1, "update": 1,
"values": [false] "values": [true, true, false]
} }
[sub_resource type="Animation" id="Animation_kb56n"] [sub_resource type="Animation" id="Animation_kb56n"]
resource_name = "ranged_prepare" resource_name = "throw_prepare"
length = 0.2 length = 0.2
loop_mode = 1 loop_mode = 1
step = 0.05 step = 0.05
@ -3100,139 +3160,151 @@ tracks/20/keys = {
"update": 0, "update": 0,
"values": [Vector2(1, 1)] "values": [Vector2(1, 1)]
} }
tracks/21/type = "value"
tracks/21/imported = false
tracks/21/enabled = true
tracks/21/path = NodePath("Root/WeaponNinjaStar:visible")
tracks/21/interp = 1
tracks/21/loop_wrap = true
tracks/21/keys = {
"times": PackedFloat32Array(0, 0.2),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [true, false]
}
[sub_resource type="Animation" id="Animation_yn0t6"] [sub_resource type="Animation" id="Animation_fh06e"]
resource_name = "ranged_throw" resource_name = "walk"
length = 0.1 length = 0.6
step = 0.05 loop_mode = 1
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/path = NodePath("Root/Rig:position") tracks/0/path = NodePath("Root/Rig/Body:position")
tracks/0/interp = 1 tracks/0/interp = 1
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/keys = { tracks/0/keys = {
"times": PackedFloat32Array(0), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [Vector2(0, -76)] "values": [Vector2(5, 53), Vector2(5, 47), Vector2(5, 53)]
} }
tracks/1/type = "value" tracks/1/type = "value"
tracks/1/imported = false tracks/1/imported = false
tracks/1/enabled = true tracks/1/enabled = true
tracks/1/path = NodePath("Root/Rig:rotation") tracks/1/path = NodePath("Root/Rig/Body:rotation")
tracks/1/interp = 1 tracks/1/interp = 1
tracks/1/loop_wrap = true tracks/1/loop_wrap = true
tracks/1/keys = { tracks/1/keys = {
"times": PackedFloat32Array(0), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [0.0] "values": [0.0, 0.0, 0.0]
} }
tracks/2/type = "value" tracks/2/type = "value"
tracks/2/imported = false tracks/2/imported = false
tracks/2/enabled = true tracks/2/enabled = true
tracks/2/path = NodePath("Root/Rig/LegL:position") tracks/2/path = NodePath("Root/Rig/Body:scale")
tracks/2/interp = 1 tracks/2/interp = 1
tracks/2/loop_wrap = true tracks/2/loop_wrap = true
tracks/2/keys = { tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [Vector2(-48, 64), Vector2(45, 67)] "values": [Vector2(1, 1), Vector2(0.92, 1.08), Vector2(1, 1)]
} }
tracks/3/type = "value" tracks/3/type = "value"
tracks/3/imported = false tracks/3/imported = false
tracks/3/enabled = true tracks/3/enabled = true
tracks/3/path = NodePath("Root/Rig/LegL:rotation") tracks/3/path = NodePath("Root/Rig/Body/Hat:position")
tracks/3/interp = 1 tracks/3/interp = 1
tracks/3/loop_wrap = true tracks/3/loop_wrap = true
tracks/3/keys = { tracks/3/keys = {
"times": PackedFloat32Array(0, 0.1), "times": PackedFloat32Array(0, 0.6),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [0.862915, -0.786391] "values": [Vector2(2, -91), Vector2(2, -91)]
} }
tracks/4/type = "value" tracks/4/type = "value"
tracks/4/imported = false tracks/4/imported = false
tracks/4/enabled = true tracks/4/enabled = true
tracks/4/path = NodePath("Root/Rig/LegR:position") tracks/4/path = NodePath("Root/Rig/Body/Hat:rotation")
tracks/4/interp = 1 tracks/4/interp = 1
tracks/4/loop_wrap = true tracks/4/loop_wrap = true
tracks/4/keys = { tracks/4/keys = {
"times": PackedFloat32Array(0, 0.1), "times": PackedFloat32Array(0, 0.6),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [Vector2(31, 65), Vector2(-27, 64)] "values": [0.0, 0.0]
} }
tracks/5/type = "value" tracks/5/type = "value"
tracks/5/imported = false tracks/5/imported = false
tracks/5/enabled = true tracks/5/enabled = true
tracks/5/path = NodePath("Root/Rig/LegR:rotation") tracks/5/path = NodePath("Root/Rig/Body/Hat:scale")
tracks/5/interp = 1 tracks/5/interp = 1
tracks/5/loop_wrap = true tracks/5/loop_wrap = true
tracks/5/keys = { tracks/5/keys = {
"times": PackedFloat32Array(0, 0.1), "times": PackedFloat32Array(0, 0.6),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1),
"update": 0, "update": 0,
"values": [0.0, 0.899266] "values": [Vector2(1, 1), Vector2(1, 1)]
} }
tracks/6/type = "value" tracks/6/type = "value"
tracks/6/imported = false tracks/6/imported = false
tracks/6/enabled = true tracks/6/enabled = true
tracks/6/path = NodePath("Root/Rig/Body:position") tracks/6/path = NodePath("Root/Rig/Body/HandL:position")
tracks/6/interp = 1 tracks/6/interp = 2
tracks/6/loop_wrap = true tracks/6/loop_wrap = true
tracks/6/keys = { tracks/6/keys = {
"times": PackedFloat32Array(0, 0.1), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [Vector2(5, 53), Vector2(5, 53)] "values": [Vector2(-60, -53), Vector2(17, -22), Vector2(-60, -53)]
} }
tracks/7/type = "value" tracks/7/type = "value"
tracks/7/imported = false tracks/7/imported = false
tracks/7/enabled = true tracks/7/enabled = true
tracks/7/path = NodePath("Root/Rig/Body:rotation") tracks/7/path = NodePath("Root/Rig/Body/HandL:rotation")
tracks/7/interp = 1 tracks/7/interp = 1
tracks/7/loop_wrap = true tracks/7/loop_wrap = true
tracks/7/keys = { tracks/7/keys = {
"times": PackedFloat32Array(0, 0.1), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [-0.250268, 0.250549] "values": [0.0, 0.0, 0.0]
} }
tracks/8/type = "value" tracks/8/type = "value"
tracks/8/imported = false tracks/8/imported = false
tracks/8/enabled = true tracks/8/enabled = true
tracks/8/path = NodePath("Root/Rig/Body/Hat:position") tracks/8/path = NodePath("Root/Rig/Body/HandL:scale")
tracks/8/interp = 1 tracks/8/interp = 1
tracks/8/loop_wrap = true tracks/8/loop_wrap = true
tracks/8/keys = { tracks/8/keys = {
"times": PackedFloat32Array(0), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [Vector2(2, -91)] "values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)]
} }
tracks/9/type = "value" tracks/9/type = "value"
tracks/9/imported = false tracks/9/imported = false
tracks/9/enabled = true tracks/9/enabled = true
tracks/9/path = NodePath("Root/Rig/Body/Hat:rotation") tracks/9/path = NodePath("Root/Rig/Body/HandR:position")
tracks/9/interp = 1 tracks/9/interp = 2
tracks/9/loop_wrap = true tracks/9/loop_wrap = true
tracks/9/keys = { tracks/9/keys = {
"times": PackedFloat32Array(0), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [0.0] "values": [Vector2(51, -51), Vector2(-26, -29), Vector2(51, -51)]
} }
tracks/10/type = "value" tracks/10/type = "value"
tracks/10/imported = false tracks/10/imported = false
tracks/10/enabled = true tracks/10/enabled = true
tracks/10/path = NodePath("Root/Rig/Body/HandL:rotation") tracks/10/path = NodePath("Root/Rig/Body/HandR:rotation")
tracks/10/interp = 1 tracks/10/interp = 1
tracks/10/loop_wrap = true tracks/10/loop_wrap = true
tracks/10/keys = { tracks/10/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [0.0, 0.0, 0.0] "values": [0.0, 0.0, 0.0]
@ -3240,38 +3312,38 @@ tracks/10/keys = {
tracks/11/type = "value" tracks/11/type = "value"
tracks/11/imported = false tracks/11/imported = false
tracks/11/enabled = true tracks/11/enabled = true
tracks/11/path = NodePath("Root/Rig/Body/HandR:position") tracks/11/path = NodePath("Root/Rig/Body/HandR:scale")
tracks/11/interp = 1 tracks/11/interp = 1
tracks/11/loop_wrap = true tracks/11/loop_wrap = true
tracks/11/keys = { tracks/11/keys = {
"times": PackedFloat32Array(0, 0.1), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [Vector2(37.6892, -51.6964), Vector2(-36.284, -25.5073)] "values": [Vector2(1, 1), Vector2(1, 1), Vector2(1, 1)]
} }
tracks/12/type = "value" tracks/12/type = "value"
tracks/12/imported = false tracks/12/imported = false
tracks/12/enabled = true tracks/12/enabled = true
tracks/12/path = NodePath("Root/Rig/Body/HandR:rotation") tracks/12/path = NodePath("Root/Rig/LegL:position")
tracks/12/interp = 1 tracks/12/interp = 2
tracks/12/loop_wrap = true tracks/12/loop_wrap = true
tracks/12/keys = { tracks/12/keys = {
"times": PackedFloat32Array(0, 0.1), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [0.0, 0.0] "values": [Vector2(-29, 65), Vector2(33, 65), Vector2(-29, 65)]
} }
tracks/13/type = "value" tracks/13/type = "value"
tracks/13/imported = false tracks/13/imported = false
tracks/13/enabled = true tracks/13/enabled = true
tracks/13/path = NodePath("Root/Rig:scale") tracks/13/path = NodePath("Root/Rig/LegL:rotation")
tracks/13/interp = 1 tracks/13/interp = 2
tracks/13/loop_wrap = true tracks/13/loop_wrap = true
tracks/13/keys = { tracks/13/keys = {
"times": PackedFloat32Array(0), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [Vector2(1, 1)] "values": [0.0, -0.991068, 0.0]
} }
tracks/14/type = "value" tracks/14/type = "value"
tracks/14/imported = false tracks/14/imported = false
@ -3280,82 +3352,58 @@ tracks/14/path = NodePath("Root/Rig/LegL:scale")
tracks/14/interp = 1 tracks/14/interp = 1
tracks/14/loop_wrap = true tracks/14/loop_wrap = true
tracks/14/keys = { tracks/14/keys = {
"times": PackedFloat32Array(0, 0.1), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [Vector2(1, 1), Vector2(1, 1)] "values": [Vector2(1.1, 1.1), Vector2(1, 1), Vector2(1.1, 1.1)]
} }
tracks/15/type = "value" tracks/15/type = "value"
tracks/15/imported = false tracks/15/imported = false
tracks/15/enabled = true tracks/15/enabled = true
tracks/15/path = NodePath("Root/Rig/LegR:scale") tracks/15/path = NodePath("Root/Rig/LegR:position")
tracks/15/interp = 1 tracks/15/interp = 2
tracks/15/loop_wrap = true tracks/15/loop_wrap = true
tracks/15/keys = { tracks/15/keys = {
"times": PackedFloat32Array(0, 0.1), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [Vector2(1, 1), Vector2(1, 1)] "values": [Vector2(31, 65), Vector2(-30, 65), Vector2(31, 65)]
} }
tracks/16/type = "value" tracks/16/type = "value"
tracks/16/imported = false tracks/16/imported = false
tracks/16/enabled = true tracks/16/enabled = true
tracks/16/path = NodePath("Root/Rig/Body:scale") tracks/16/path = NodePath("Root/Rig/LegR:rotation")
tracks/16/interp = 1 tracks/16/interp = 2
tracks/16/loop_wrap = true tracks/16/loop_wrap = true
tracks/16/keys = { tracks/16/keys = {
"times": PackedFloat32Array(0, 0.1), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1, 1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [Vector2(0.9, 1.1), Vector2(1.1, 0.9)] "values": [0.0, 1.13756, 0.0]
} }
tracks/17/type = "value" tracks/17/type = "value"
tracks/17/imported = false tracks/17/imported = false
tracks/17/enabled = true tracks/17/enabled = true
tracks/17/path = NodePath("Root/Rig/Body/Hat:scale") tracks/17/path = NodePath("Root/Rig/LegR:scale")
tracks/17/interp = 1 tracks/17/interp = 1
tracks/17/loop_wrap = true tracks/17/loop_wrap = true
tracks/17/keys = { tracks/17/keys = {
"times": PackedFloat32Array(0), "times": PackedFloat32Array(0, 0.3, 0.6),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1, 1, 1),
"update": 0, "update": 0,
"values": [Vector2(1, 1)] "values": [Vector2(1, 1), Vector2(1.1, 1.1), Vector2(1, 1)]
} }
tracks/18/type = "value" tracks/18/type = "value"
tracks/18/imported = false tracks/18/imported = false
tracks/18/enabled = true tracks/18/enabled = true
tracks/18/path = NodePath("Root/Rig/Body/HandL:position") tracks/18/path = NodePath("Root/FX/Cloud:visible")
tracks/18/interp = 1 tracks/18/interp = 1
tracks/18/loop_wrap = true tracks/18/loop_wrap = true
tracks/18/keys = { tracks/18/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1, 1, 1), "transitions": PackedFloat32Array(1),
"update": 0, "update": 1,
"values": [Vector2(-70.3036, -52.0327), Vector2(-5.01252, -88.9993), Vector2(66.2323, -78.0635)] "values": [false]
}
tracks/19/type = "value"
tracks/19/imported = false
tracks/19/enabled = true
tracks/19/path = NodePath("Root/Rig/Body/HandL:scale")
tracks/19/interp = 1
tracks/19/loop_wrap = true
tracks/19/keys = {
"times": PackedFloat32Array(0, 0.05, 0.1),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Vector2(1, 1), Vector2(1, 1), Vector2(1.5, 1.5)]
}
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),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(1, 1), Vector2(1, 1)]
} }
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ws2ti"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_ws2ti"]
@ -3367,11 +3415,11 @@ _data = {
"death": SubResource("Animation_wei72"), "death": SubResource("Animation_wei72"),
"hurt": SubResource("Animation_gowr5"), "hurt": SubResource("Animation_gowr5"),
"idle": SubResource("Animation_gnqgt"), "idle": SubResource("Animation_gnqgt"),
"ranged_prepare": SubResource("Animation_kb56n"),
"ranged_throw": SubResource("Animation_yn0t6"),
"roll": SubResource("Animation_msfb2"), "roll": SubResource("Animation_msfb2"),
"spit": SubResource("Animation_uow76"), "spit": SubResource("Animation_uow76"),
"summon": SubResource("Animation_5mxvi"), "summon": SubResource("Animation_5mxvi"),
"throw": SubResource("Animation_yn0t6"),
"throw_prepare": SubResource("Animation_kb56n"),
"walk": SubResource("Animation_fh06e") "walk": SubResource("Animation_fh06e")
} }
@ -3422,6 +3470,10 @@ texture = ExtResource("1_1u51b")
region_enabled = true region_enabled = true
region_rect = Rect2(111.022, 6.27016, 27.6329, 27.1423) region_rect = Rect2(111.022, 6.27016, 27.6329, 27.1423)
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Root/Rig/Body/HandL"]
remote_path = NodePath("../../../../WeaponNinjaStar")
update_scale = false
[node name="HandR" type="Sprite2D" parent="Root/Rig/Body"] [node name="HandR" type="Sprite2D" parent="Root/Rig/Body"]
show_behind_parent = true show_behind_parent = true
position = Vector2(51, -51) position = Vector2(51, -51)
@ -3451,8 +3503,16 @@ one_shot = true
explosiveness = 0.7 explosiveness = 0.7
fixed_fps = 60 fixed_fps = 60
[node name="WeaponNinjaStar" type="Sprite2D" parent="Root"]
visible = false
position = Vector2(-55, -76)
scale = Vector2(0.999983, 0.999976)
texture = ExtResource("4_1c5xq")
[node name="Hitbox" type="Area2D" parent="Root"] [node name="Hitbox" type="Area2D" parent="Root"]
position = Vector2(50, 0) position = Vector2(50, 0)
collision_layer = 0
collision_mask = 4
script = ExtResource("5_taq6b") script = ExtResource("5_taq6b")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Root/Hitbox"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Root/Hitbox"]
@ -3462,6 +3522,8 @@ debug_color = Color(0.933131, 0.0801983, 0.605982, 0.42)
metadata/_edit_lock_ = true metadata/_edit_lock_ = true
[node name="Hurtbox" type="Area2D" parent="Root" node_paths=PackedStringArray("health")] [node name="Hurtbox" type="Area2D" parent="Root" node_paths=PackedStringArray("health")]
collision_layer = 8
collision_mask = 0
script = ExtResource("6_jnvxm") script = ExtResource("6_jnvxm")
health = NodePath("../../Health") health = NodePath("../../Health")
@ -3471,10 +3533,9 @@ debug_color = Color(0.466325, 0.590206, 0.107862, 0.42)
metadata/_edit_lock_ = true metadata/_edit_lock_ = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
visible = false
position = Vector2(-1, -7) position = Vector2(-1, -7)
scale = Vector2(0.6, 0.16) rotation = 1.5708
shape = SubResource("CircleShape2D_so8wt") shape = SubResource("CapsuleShape2D_aa16q")
[node name="Health" type="Node" parent="."] [node name="Health" type="Node" parent="."]
script = ExtResource("4_qwtrf") script = ExtResource("4_qwtrf")

View File

@ -18,13 +18,13 @@ var/flank_speed/hint_string = "10,1000,10"
[node name="AgentMeleeNuanced" instance=ExtResource("1_afx5l")] [node name="AgentMeleeNuanced" instance=ExtResource("1_afx5l")]
[node name="LegL" parent="Root/Rig" index="0"] [node name="LegL" parent="Root/Rig" index="1"]
texture = ExtResource("2_e51r0") texture = ExtResource("2_e51r0")
[node name="LegR" parent="Root/Rig" index="1"] [node name="LegR" parent="Root/Rig" index="2"]
texture = ExtResource("2_e51r0") texture = ExtResource("2_e51r0")
[node name="Body" parent="Root/Rig" index="2"] [node name="Body" parent="Root/Rig" index="3"]
texture = ExtResource("2_e51r0") texture = ExtResource("2_e51r0")
[node name="Hat" parent="Root/Rig/Body" index="0"] [node name="Hat" parent="Root/Rig/Body" index="0"]

View File

@ -0,0 +1,51 @@
#*
#* ninja_star.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 Node2D
const SPEED := 800.0
const DEAD_SPEED := 400.0
@export var dir: float = 1.0
var _is_dead: bool = false
@onready var ninja_star: Sprite2D = $Root/NinjaStar
@onready var death: GPUParticles2D = $Death
@onready var collision_shape_2d: CollisionShape2D = $Hitbox/CollisionShape2D
@onready var root: Node2D = $Root
func _ready() -> void:
var tween := create_tween().set_loops()
tween.tween_property(ninja_star, ^"rotation", TAU * signf(dir), 1.0).as_relative()
var tween2 := create_tween().set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_IN)
tween2.tween_property(ninja_star, "position:y", -10.0, 0.5).as_relative().set_ease(Tween.EASE_OUT)
tween2.tween_property(ninja_star, "position:y", 0.0, 1.0)
tween2.tween_callback(_die)
func _physics_process(delta: float) -> void:
var speed: float = SPEED if not _is_dead else DEAD_SPEED
position += Vector2.RIGHT * speed * dir * delta
func _die() -> void:
_is_dead = true
root.hide()
collision_shape_2d.set_deferred(&"disabled", true)
death.emitting = true
await death.finished
queue_free()
func _on_hitbox_area_entered(_area: Area2D) -> void:
_die()

View File

@ -0,0 +1,74 @@
[gd_scene load_steps=10 format=3 uid="uid://bj5n72nomeaci"]
[ext_resource type="Script" path="res://demo/agents/ninja_star/ninja_star.gd" id="1_pja57"]
[ext_resource type="Texture2D" uid="uid://2uyxh7sy8qny" path="res://demo/assets/weapon_ninja_star.png" id="1_ptof7"]
[ext_resource type="Texture2D" uid="uid://dwhhxj5557qrb" path="res://demo/assets/shadow.png" id="2_2rj5a"]
[ext_resource type="Script" path="res://demo/agents/scripts/hitbox.gd" id="2_iem02"]
[ext_resource type="Texture2D" uid="uid://bdusy0qqtw0th" path="res://demo/assets/smoke.png" id="5_t37aw"]
[sub_resource type="CircleShape2D" id="CircleShape2D_7uc1b"]
radius = 25.13
[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]
point_count = 3
[sub_resource type="CurveTexture" id="CurveTexture_1f5jp"]
curve = SubResource("Curve_ugmtv")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_gilhy"]
lifetime_randomness = 0.5
particle_flag_disable_z = true
emission_shape = 3
emission_box_extents = Vector3(40, 1, 1)
direction = Vector3(0, -1, 0)
spread = 90.0
initial_velocity_min = 150.0
initial_velocity_max = 250.0
angular_velocity_min = -90.0
angular_velocity_max = 90.0
gravity = Vector3(0, 0, 0)
radial_accel_min = -90.0
radial_accel_max = 90.0
damping_min = 200.0
damping_max = 200.0
scale_min = 0.8
scale_max = 1.2
scale_curve = SubResource("CurveTexture_1f5jp")
[node name="NinjaStar" type="Node2D"]
script = ExtResource("1_pja57")
[node name="Root" type="Node2D" parent="."]
[node name="Shadow" type="Sprite2D" parent="Root"]
modulate = Color(1, 1, 1, 0.686275)
position = Vector2(0, -1)
scale = Vector2(0.382, 0.297)
texture = ExtResource("2_2rj5a")
[node name="NinjaStar" type="Sprite2D" parent="Root"]
position = Vector2(0, -93)
texture = ExtResource("1_ptof7")
[node name="Hitbox" type="Area2D" parent="."]
collision_layer = 0
collision_mask = 4
script = ExtResource("2_iem02")
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
shape = SubResource("CircleShape2D_7uc1b")
debug_color = Color(0.839216, 0.192157, 0.815686, 0.419608)
[node name="Death" type="GPUParticles2D" parent="."]
emitting = false
amount = 1
process_material = SubResource("ParticleProcessMaterial_gilhy")
texture = ExtResource("5_t37aw")
lifetime = 0.7
one_shot = true
explosiveness = 0.7
fixed_fps = 60
local_coords = true
[connection signal="area_entered" from="Hitbox" to="." method="_on_hitbox_area_entered"]

View File

@ -9,6 +9,12 @@
[node name="Player" groups=["player"] instance=ExtResource("1_mswd4")] [node name="Player" groups=["player"] instance=ExtResource("1_mswd4")]
script = ExtResource("2_24nyi") script = ExtResource("2_24nyi")
[node name="Hitbox" parent="Root" index="3"]
collision_mask = 8
[node name="Hurtbox" parent="Root" index="4"]
collision_layer = 4
[node name="LimboHSM" type="LimboHSM" parent="." index="4"] [node name="LimboHSM" type="LimboHSM" parent="." index="4"]
[node name="IdleState" type="LimboState" parent="LimboHSM" index="0" node_paths=PackedStringArray("animation_player")] [node name="IdleState" type="LimboState" parent="LimboHSM" index="0" node_paths=PackedStringArray("animation_player")]

View File

@ -12,11 +12,14 @@ extends CharacterBody2D
## Base agent script. ## Base agent script.
const NinjaStar := preload("res://demo/agents/ninja_star/ninja_star.tscn")
@onready var animation_player: AnimationPlayer = $AnimationPlayer @onready var animation_player: AnimationPlayer = $AnimationPlayer
@onready var health: Health = $Health @onready var health: Health = $Health
@onready var root: Node2D = $Root @onready var root: Node2D = $Root
var _frames_since_facing_update: int = 0 var _frames_since_facing_update: int = 0
var _is_dead: bool = false
func _ready() -> void: func _ready() -> void:
health.damaged.connect(_damaged) health.damaged.connect(_damaged)
@ -42,6 +45,17 @@ func face_dir(dir: float) -> void:
_frames_since_facing_update = 0 _frames_since_facing_update = 0
func get_facing() -> float:
return signf(root.scale.x)
func throw_ninja_star() -> void:
var ninja_star := NinjaStar.instantiate()
ninja_star.dir = get_facing()
get_parent().add_child(ninja_star)
ninja_star.global_position = global_position + Vector2.RIGHT * 100.0 * get_facing()
func _damaged(_amount: float) -> void: func _damaged(_amount: float) -> void:
animation_player.play(&"hurt") animation_player.play(&"hurt")
var btplayer := get_node_or_null(^"BTPlayer") as BTPlayer var btplayer := get_node_or_null(^"BTPlayer") as BTPlayer
@ -51,13 +65,14 @@ func _damaged(_amount: float) -> void:
if hsm: if hsm:
hsm.set_active(false) hsm.set_active(false)
await animation_player.animation_finished await animation_player.animation_finished
if btplayer: if btplayer and not _is_dead:
btplayer.restart() btplayer.restart()
if hsm: if hsm and not _is_dead:
hsm.set_active(true) hsm.set_active(true)
func _die() -> void: func _die() -> void:
_is_dead = true
animation_player.play(&"death") animation_player.play(&"death")
for child in get_children(): for child in get_children():

View File

@ -26,7 +26,7 @@ func _ready() -> void:
func take_damage(amount: float) -> void: func take_damage(amount: float) -> void:
if _current <= 0: if _current <= 0.0:
return return
_current -= amount _current -= amount

View File

@ -16,11 +16,6 @@ extends Area2D
@export var damage: float = 1.0 @export var damage: float = 1.0
func _init() -> void:
collision_layer = 0
collision_mask = 4
func _ready() -> void: func _ready() -> void:
area_entered.connect(_area_entered) area_entered.connect(_area_entered)

View File

@ -16,11 +16,6 @@ extends Area2D
@export var health: Health @export var health: Health
func _init() -> void:
collision_layer = 4
collision_mask = 0
func take_damage(amount: float, source: Area2D) -> void: func take_damage(amount: float, source: Area2D) -> void:
if source.owner == owner: if source.owner == owner:
# Don't damage yourself. # Don't damage yourself.

View File

@ -23,13 +23,13 @@ func _generate_name() -> String:
LimboUtility.decorate_var(target_position_var), LimboUtility.decorate_var(target_position_var),
] ]
func _tick(p_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:
return SUCCESS return SUCCESS
var speed: float = blackboard.get_var(speed_var, 10.0) var speed: float = blackboard.get_var(speed_var, 10.0)
var dist: float = agent.global_position.distance_to(target_pos) var dist: float = absf(agent.global_position.x - target_pos.x)
var vertical_factor: float = remap(dist, 200.0, 500.0, 1.0, 0.0) var vertical_factor: float = remap(dist, 200.0, 500.0, 1.0, 0.0)
vertical_factor = clampf(vertical_factor, 0.0, 1.0) vertical_factor = clampf(vertical_factor, 0.0, 1.0)
var dir: Vector2 = agent.global_position.direction_to(target_pos) var dir: Vector2 = agent.global_position.direction_to(target_pos)

View File

@ -23,7 +23,7 @@ func _generate_name() -> String:
LimboUtility.decorate_var(position_var)] LimboUtility.decorate_var(position_var)]
# 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:
var target: CharacterBody2D = blackboard.get_var(target_var) var target: CharacterBody2D = blackboard.get_var(target_var)
if not is_instance_valid(target): if not is_instance_valid(target):
return FAILURE return FAILURE

View File

@ -1,4 +1,4 @@
[gd_resource type="BehaviorTree" load_steps=34 format=3 uid="uid://c2u6sljqkim0n"] [gd_resource type="BehaviorTree" load_steps=40 format=3 uid="uid://c2u6sljqkim0n"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_uvue5"] [ext_resource type="Script" path="res://demo/ai/tasks/get_first_in_group.gd" id="1_uvue5"]
[ext_resource type="Script" path="res://demo/ai/tasks/get_flank_pos.gd" id="2_0llce"] [ext_resource type="Script" path="res://demo/ai/tasks/get_flank_pos.gd" id="2_0llce"]
@ -31,15 +31,15 @@ blend = 0.1
min_duration = 0.7 min_duration = 0.7
max_duration = 1.5 max_duration = 1.5
[sub_resource type="BTSequence" id="BTSequence_yhjh1"]
custom_name = "Pause before action"
children = [SubResource("BTPlayAnimation_qiw21"), SubResource("BTRandomWait_xlud8")]
[sub_resource type="BTAction" id="BTAction_c4cxo"] [sub_resource type="BTAction" id="BTAction_c4cxo"]
script = ExtResource("1_uvue5") script = ExtResource("1_uvue5")
group = &"player" group = &"player"
output_var = "_target" output_var = "_target"
[sub_resource type="BTSequence" id="BTSequence_yhjh1"]
custom_name = "Pause before action"
children = [SubResource("BTPlayAnimation_qiw21"), SubResource("BTRandomWait_xlud8"), SubResource("BTAction_c4cxo")]
[sub_resource type="BTAction" id="BTAction_qr6nr"] [sub_resource type="BTAction" id="BTAction_qr6nr"]
script = ExtResource("2_0llce") script = ExtResource("2_0llce")
target_var = "_target" target_var = "_target"
@ -63,7 +63,6 @@ speed_var = "flank_speed"
tolerance = 50.0 tolerance = 50.0
[sub_resource type="BTTimeLimit" id="BTTimeLimit_24ath"] [sub_resource type="BTTimeLimit" id="BTTimeLimit_24ath"]
time_limit = 10.0
children = [SubResource("BTAction_66hsk")] children = [SubResource("BTAction_66hsk")]
[sub_resource type="BTAction" id="BTAction_enw2m"] [sub_resource type="BTAction" id="BTAction_enw2m"]
@ -72,12 +71,13 @@ target_var = "_target"
[sub_resource type="BTSequence" id="BTSequence_lhg7f"] [sub_resource type="BTSequence" id="BTSequence_lhg7f"]
custom_name = "Flank player" custom_name = "Flank player"
children = [SubResource("BTAction_c4cxo"), SubResource("BTAction_qr6nr"), SubResource("BTPlayAnimation_panch"), SubResource("BTTimeLimit_24ath"), SubResource("BTAction_enw2m")] children = [SubResource("BTAction_qr6nr"), SubResource("BTPlayAnimation_panch"), SubResource("BTTimeLimit_24ath"), SubResource("BTAction_enw2m")]
metadata/_weight_ = 1.0 metadata/_weight_ = 1.0
[sub_resource type="BTCooldown" id="BTCooldown_skw41"] [sub_resource type="BTCooldown" id="BTCooldown_skw41"]
duration = 5.0 duration = 5.0
children = [SubResource("BTSequence_lhg7f")] children = [SubResource("BTSequence_lhg7f")]
metadata/_weight_ = 2.0
[sub_resource type="BBNode" id="BBNode_wpj6d"] [sub_resource type="BBNode" id="BBNode_wpj6d"]
saved_value = NodePath("AnimationPlayer") saved_value = NodePath("AnimationPlayer")
@ -88,11 +88,6 @@ animation_player = SubResource("BBNode_wpj6d")
animation_name = &"walk" animation_name = &"walk"
blend = 0.1 blend = 0.1
[sub_resource type="BTAction" id="BTAction_ulbrf"]
script = ExtResource("1_uvue5")
group = &"player"
output_var = "_target"
[sub_resource type="BTAction" id="BTAction_a4jqi"] [sub_resource type="BTAction" id="BTAction_a4jqi"]
script = ExtResource("2_aanv5") script = ExtResource("2_aanv5")
target_var = "_target" target_var = "_target"
@ -103,10 +98,6 @@ approach_distance = 100.0
time_limit = 2.0 time_limit = 2.0
children = [SubResource("BTAction_a4jqi")] children = [SubResource("BTAction_a4jqi")]
[sub_resource type="BTSequence" id="BTSequence_vd4xt"]
custom_name = "Approach"
children = [SubResource("BTPlayAnimation_olf37"), SubResource("BTAction_ulbrf"), SubResource("BTTimeLimit_xek5v")]
[sub_resource type="BTAction" id="BTAction_kidxn"] [sub_resource type="BTAction" id="BTAction_kidxn"]
script = ExtResource("3_r5itf") script = ExtResource("3_r5itf")
target_var = "_target" target_var = "_target"
@ -123,17 +114,52 @@ await_completion = 2.0
animation_player = SubResource("BBNode_s8evu") animation_player = SubResource("BBNode_s8evu")
animation_name = &"attack_3" animation_name = &"attack_3"
[sub_resource type="BTSequence" id="BTSequence_ww5v2"]
custom_name = "Melee attack"
children = [SubResource("BTAction_kidxn"), SubResource("BTWait_tadkc"), SubResource("BTPlayAnimation_ppmxd")]
[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("BTSequence_vd4xt"), SubResource("BTSequence_ww5v2")] children = [SubResource("BTPlayAnimation_olf37"), SubResource("BTTimeLimit_xek5v"), SubResource("BTAction_kidxn"), SubResource("BTWait_tadkc"), SubResource("BTPlayAnimation_ppmxd")]
metadata/_weight_ = 3.0
[sub_resource type="BTAction" id="BTAction_8q20y"]
script = ExtResource("3_r5itf")
target_var = "_target"
[sub_resource type="BBNode" id="BBNode_s6vt4"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_qa8jy"]
animation_player = SubResource("BBNode_s6vt4")
animation_name = &"throw_prepare"
blend = 0.1
[sub_resource type="BTWait" id="BTWait_gbcyb"]
[sub_resource type="BBNode" id="BBNode_qkfqt"]
saved_value = NodePath("AnimationPlayer")
resource_name = "AnimationPlayer"
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_0ktds"]
await_completion = 1.0
animation_player = SubResource("BBNode_qkfqt")
animation_name = &"throw"
blend = 0.05
[sub_resource type="BBNode" id="BBNode_1yxc5"]
saved_value = NodePath(".")
resource_name = "."
[sub_resource type="BTCallMethod" id="BTCallMethod_yx4fk"]
node = SubResource("BBNode_1yxc5")
method = &"throw_ninja_star"
[sub_resource type="BTSequence" id="BTSequence_rgbq3"]
custom_name = "Throw ninja star"
children = [SubResource("BTAction_8q20y"), SubResource("BTPlayAnimation_qa8jy"), SubResource("BTWait_gbcyb"), SubResource("BTPlayAnimation_0ktds"), SubResource("BTCallMethod_yx4fk")]
metadata/_weight_ = 1.0
[sub_resource type="BTProbabilitySelector" id="BTProbabilitySelector_rjsiq"] [sub_resource type="BTProbabilitySelector" id="BTProbabilitySelector_rjsiq"]
abort_on_failure = true abort_on_failure = true
children = [SubResource("BTCooldown_skw41"), SubResource("BTSequence_1xfnq")] children = [SubResource("BTCooldown_skw41"), SubResource("BTSequence_1xfnq"), SubResource("BTSequence_rgbq3")]
[sub_resource type="BTSequence" id="BTSequence_pxl2k"] [sub_resource type="BTSequence" id="BTSequence_pxl2k"]
custom_name = "Main" custom_name = "Main"

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=6 format=3 uid="uid://bpd1wmw2f7bvg"] [gd_scene load_steps=8 format=3 uid="uid://bpd1wmw2f7bvg"]
[ext_resource type="Texture2D" uid="uid://i476iia1ua8q" path="res://demo/assets/env_gong.png" id="1_kbnv6"] [ext_resource type="Texture2D" uid="uid://i476iia1ua8q" path="res://demo/assets/env_gong.png" id="1_kbnv6"]
[ext_resource type="Texture2D" uid="uid://dwhhxj5557qrb" path="res://demo/assets/shadow.png" id="1_vl1mv"]
[ext_resource type="Texture2D" uid="uid://dj4oayt5ttvh8" path="res://demo/assets/fx.png" id="2_dib3m"] [ext_resource type="Texture2D" uid="uid://dj4oayt5ttvh8" path="res://demo/assets/fx.png" id="2_dib3m"]
[sub_resource type="Animation" id="Animation_i5ovs"] [sub_resource type="Animation" id="Animation_i5ovs"]
@ -807,9 +808,18 @@ _data = {
"struck": SubResource("Animation_ie54r") "struck": SubResource("Animation_ie54r")
} }
[node name="Gong" type="Node2D"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_nixvt"]
radius = 20.91
height = 186.37
[node name="Gong" type="StaticBody2D"]
metadata/_edit_horizontal_guides_ = [111.0] metadata/_edit_horizontal_guides_ = [111.0]
[node name="Shadow" type="Sprite2D" parent="."]
position = Vector2(0, -8)
scale = Vector2(2.31, 1.7)
texture = ExtResource("1_vl1mv")
[node name="Gong" type="Sprite2D" parent="."] [node name="Gong" type="Sprite2D" parent="."]
texture = ExtResource("1_kbnv6") texture = ExtResource("1_kbnv6")
offset = Vector2(0, -110) offset = Vector2(0, -110)
@ -882,3 +892,8 @@ libraries = {
} }
[node name="GongSFX" type="AudioStreamPlayer" parent="."] [node name="GongSFX" type="AudioStreamPlayer" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -14.395)
rotation = 1.5708
shape = SubResource("CapsuleShape2D_nixvt")

View File

@ -56,8 +56,8 @@ attack={
2d_physics/layer_1="Obstacle" 2d_physics/layer_1="Obstacle"
2d_physics/layer_2="Player" 2d_physics/layer_2="Player"
2d_physics/layer_3="Hurtbox" 2d_physics/layer_3="BoxPlayer"
2d_physics/layer_4="Enemy" 2d_physics/layer_4="BoxEnemy"
[limbo_ai] [limbo_ai]