Compare commits

...

2 commits

Author SHA1 Message Date
Raxki 0824b85090 Add attack hitbox animation for Hiro player 2024-08-31 17:13:48 -04:00
Raxki 457bd0e2d7 Add reactions to attacks on AI dummy 2024-08-31 15:59:24 -04:00
6 changed files with 2471 additions and 36 deletions

1834
Hiro/hiro_ai.tscn Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,9 @@
[gd_scene load_steps=61 format=3 uid="uid://di21xheryhp0k"]
[gd_scene load_steps=72 format=3 uid="uid://di21xheryhp0k"]
[ext_resource type="Script" path="res://Scripts/hiro_player.gd" id="1_dtymi"]
[ext_resource type="Texture2D" uid="uid://cm7tgomrcvq30" path="res://Hiro/Hiro Walk Sprite Cycle Line Up.png" id="1_ukwcc"]
[ext_resource type="Texture2D" uid="uid://bio3egs7q7wog" path="res://Hiro/Hiro Melee Sprites.png" id="2_d32ue"]
[ext_resource type="Texture2D" uid="uid://rcidedgcjqg6" path="res://Hiro/Hiro Hurt Sprites.png" id="4_sooc4"]
[sub_resource type="Animation" id="Animation_04piu"]
length = 0.001
@ -66,6 +67,242 @@ tracks/4/keys = {
"update": 1,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Attackbox/Collider:position")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, -10)]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Attackbox/Collider:disabled")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="Animation" id="Animation_kvnht"]
resource_name = "hurt_east"
length = 0.500013
step = 0.125
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:texture")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("4_sooc4")]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite2D:hframes")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [5]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Sprite2D:vframes")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [4]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Sprite2D:frame")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.125, 0.25, 0.375),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [6, 7, 8, 9]
}
[sub_resource type="Animation" id="Animation_fytkh"]
resource_name = "hurt_north"
length = 0.500013
step = 0.125
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:texture")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("4_sooc4")]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite2D:hframes")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [5]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Sprite2D:vframes")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [4]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Sprite2D:frame")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.125, 0.25, 0.375),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [10, 11, 12, 13]
}
[sub_resource type="Animation" id="Animation_lw5of"]
resource_name = "hurt_south"
length = 0.500013
step = 0.125
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:texture")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("4_sooc4")]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite2D:hframes")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [5]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Sprite2D:vframes")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [4]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Sprite2D:frame")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.125, 0.25, 0.375),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [1, 2, 3, 4]
}
[sub_resource type="Animation" id="Animation_htnmm"]
resource_name = "hurt_west"
length = 0.500013
step = 0.125
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:texture")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("4_sooc4")]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite2D:hframes")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [5]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Sprite2D:vframes")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [4]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Sprite2D:frame")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.125, 0.25, 0.375),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [16, 17, 18, 19]
}
[sub_resource type="Animation" id="Animation_3oagy"]
resource_name = "idle_east"
@ -340,6 +577,30 @@ tracks/4/keys = {
"update": 1,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Attackbox/Collider:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false, true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Attackbox/Collider:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(12, -11), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_cuaji"]
resource_name = "kick_north"
@ -406,6 +667,30 @@ tracks/4/keys = {
"update": 1,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Attackbox/Collider:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false, true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Attackbox/Collider:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(0, -30), Vector2(12, -11), Vector2(0, -30), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_hqga6"]
resource_name = "kick_south"
@ -472,6 +757,30 @@ tracks/4/keys = {
"update": 1,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Attackbox/Collider:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false, true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Attackbox/Collider:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(0, 2), Vector2(12, -11), Vector2(0, 2), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_s8xim"]
resource_name = "kick_west"
@ -538,6 +847,30 @@ tracks/4/keys = {
"update": 1,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Attackbox/Collider:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false, true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Attackbox/Collider:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(-12, -11), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_o0diw"]
resource_name = "punch_east_left"
@ -604,6 +937,30 @@ tracks/4/keys = {
"update": 1,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Attackbox/Collider:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false, true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Attackbox/Collider:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(12, -11), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_ar6r3"]
resource_name = "punch_east_rigth"
@ -670,6 +1027,30 @@ tracks/4/keys = {
"update": 1,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Attackbox/Collider:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false, true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Attackbox/Collider:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(12, -11), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_1e0v6"]
resource_name = "punch_north_left"
@ -736,6 +1117,30 @@ tracks/4/keys = {
"update": 1,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Attackbox/Collider:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false, true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Attackbox/Collider:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(0, -30), Vector2(12, -11), Vector2(0, -30), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_bwm5c"]
resource_name = "punch_north_rigth"
@ -802,6 +1207,30 @@ tracks/4/keys = {
"update": 1,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Attackbox/Collider:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false, true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Attackbox/Collider:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(0, -30), Vector2(12, -11), Vector2(0, -30), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_qmuik"]
resource_name = "punch_south_left"
@ -868,6 +1297,30 @@ tracks/4/keys = {
"update": 1,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Attackbox/Collider:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false, true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Attackbox/Collider:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(0, 2), Vector2(12, -11), Vector2(0, 2), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_bw220"]
resource_name = "punch_south_rigth"
@ -934,6 +1387,30 @@ tracks/4/keys = {
"update": 1,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Attackbox/Collider:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false, true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Attackbox/Collider:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(0, 2), Vector2(12, -11), Vector2(0, 2), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_wjl2t"]
resource_name = "punch_west_left"
@ -1000,6 +1477,30 @@ tracks/4/keys = {
"update": 1,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Attackbox/Collider:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false, true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Attackbox/Collider:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(-12, -11), Vector2(12, -11), Vector2(-12, -11), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_e4rxs"]
resource_name = "punch_west_rigth"
@ -1066,6 +1567,30 @@ tracks/4/keys = {
"update": 1,
"values": [false]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Attackbox/Collider:disabled")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [true, false, true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Attackbox/Collider:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.133333, 0.199527, 0.2, 0.266667),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2(0, -11), Vector2(-12, -11), Vector2(12, -11), Vector2(-12, -11), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_de3xn"]
resource_name = "walking_east"
@ -1286,6 +1811,10 @@ tracks/3/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_prr1g"]
_data = {
"RESET": SubResource("Animation_04piu"),
"hurt_east": SubResource("Animation_kvnht"),
"hurt_north": SubResource("Animation_fytkh"),
"hurt_south": SubResource("Animation_lw5of"),
"hurt_west": SubResource("Animation_htnmm"),
"idle_east": SubResource("Animation_3oagy"),
"idle_north": SubResource("Animation_pjwlc"),
"idle_south": SubResource("Animation_x2yda"),
@ -1308,26 +1837,49 @@ _data = {
"walking_west": SubResource("Animation_d3phq")
}
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_x1ach"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_tyc74"]
animation = &"hurt_west"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_0vb6l"]
animation = &"hurt_south"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_rm4rl"]
animation = &"hurt_east"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ob16h"]
animation = &"hurt_north"
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_h2vkc"]
blend_point_0/node = SubResource("AnimationNodeAnimation_tyc74")
blend_point_0/pos = Vector2(-1, 0)
blend_point_1/node = SubResource("AnimationNodeAnimation_0vb6l")
blend_point_1/pos = Vector2(0, 1)
blend_point_2/node = SubResource("AnimationNodeAnimation_rm4rl")
blend_point_2/pos = Vector2(1, 0)
blend_point_3/node = SubResource("AnimationNodeAnimation_ob16h")
blend_point_3/pos = Vector2(0, -1)
blend_mode = 1
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6ohpw"]
animation = &"idle_west"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_bt5hk"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_330gg"]
animation = &"idle_east"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_d37x4"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_lsntm"]
animation = &"idle_north"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_2vw4b"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_g1i0e"]
animation = &"idle_south"
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_bd8j1"]
blend_point_0/node = SubResource("AnimationNodeAnimation_x1ach")
blend_point_0/node = SubResource("AnimationNodeAnimation_6ohpw")
blend_point_0/pos = Vector2(-1, 0)
blend_point_1/node = SubResource("AnimationNodeAnimation_bt5hk")
blend_point_1/node = SubResource("AnimationNodeAnimation_330gg")
blend_point_1/pos = Vector2(1, 0)
blend_point_2/node = SubResource("AnimationNodeAnimation_d37x4")
blend_point_2/node = SubResource("AnimationNodeAnimation_lsntm")
blend_point_2/pos = Vector2(0, -1)
blend_point_3/node = SubResource("AnimationNodeAnimation_2vw4b")
blend_point_3/node = SubResource("AnimationNodeAnimation_g1i0e")
blend_point_3/pos = Vector2(0, 1)
blend_mode = 1
@ -1343,7 +1895,7 @@ animation = &"punch_east_rigth"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_y3tw5"]
animation = &"punch_north_rigth"
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_flbdw"]
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_2orb0"]
blend_point_0/node = SubResource("AnimationNodeAnimation_f740i")
blend_point_0/pos = Vector2(0, 1)
blend_point_1/node = SubResource("AnimationNodeAnimation_bwovr")
@ -1366,7 +1918,7 @@ animation = &"punch_east_left"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ryihd"]
animation = &"punch_south_left"
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_c2jh5"]
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_dd6tw"]
blend_point_0/node = SubResource("AnimationNodeAnimation_ruw2d")
blend_point_0/pos = Vector2(-1, 0)
blend_point_1/node = SubResource("AnimationNodeAnimation_iu52b")
@ -1389,7 +1941,7 @@ animation = &"kick_west"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_awga0"]
animation = &"kick_south"
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_iktiu"]
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_mr7t3"]
blend_point_0/node = SubResource("AnimationNodeAnimation_p4b5o")
blend_point_0/pos = Vector2(1, 0)
blend_point_1/node = SubResource("AnimationNodeAnimation_vay80")
@ -1401,34 +1953,34 @@ blend_point_3/pos = Vector2(0, 1)
blend_mode = 1
[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_dc3kp"]
blend_point_0/node = SubResource("AnimationNodeBlendSpace2D_flbdw")
blend_point_0/node = SubResource("AnimationNodeBlendSpace2D_2orb0")
blend_point_0/pos = 0.0
blend_point_1/node = SubResource("AnimationNodeBlendSpace2D_c2jh5")
blend_point_1/node = SubResource("AnimationNodeBlendSpace2D_dd6tw")
blend_point_1/pos = 0.5
blend_point_2/node = SubResource("AnimationNodeBlendSpace2D_iktiu")
blend_point_2/node = SubResource("AnimationNodeBlendSpace2D_mr7t3")
blend_point_2/pos = 1.0
blend_mode = 1
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_e3il4"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_17wsb"]
animation = &"walking_north"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ul1hc"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_j520c"]
animation = &"walking_south"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ns4dm"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_srrrs"]
animation = &"walking_west"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ck8m6"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_4ypsn"]
animation = &"walking_east"
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_vunsg"]
blend_point_0/node = SubResource("AnimationNodeAnimation_e3il4")
blend_point_0/node = SubResource("AnimationNodeAnimation_17wsb")
blend_point_0/pos = Vector2(0, -1)
blend_point_1/node = SubResource("AnimationNodeAnimation_ul1hc")
blend_point_1/node = SubResource("AnimationNodeAnimation_j520c")
blend_point_1/pos = Vector2(0, 1)
blend_point_2/node = SubResource("AnimationNodeAnimation_ns4dm")
blend_point_2/node = SubResource("AnimationNodeAnimation_srrrs")
blend_point_2/pos = Vector2(-1, 0)
blend_point_3/node = SubResource("AnimationNodeAnimation_ck8m6")
blend_point_3/node = SubResource("AnimationNodeAnimation_4ypsn")
blend_point_3/pos = Vector2(1, 0)
blend_mode = 1
@ -1451,17 +2003,23 @@ advance_condition = &"melee"
advance_mode = 2
advance_expression = "get(\"parameters/conditions/melee\") == false"
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_b0avg"]
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ln3pc"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_b2867"]
allow_transition_to_self = true
states/Start/position = Vector2(197, 108)
states/hurt/node = SubResource("AnimationNodeBlendSpace2D_h2vkc")
states/hurt/position = Vector2(329, -13)
states/idle/node = SubResource("AnimationNodeBlendSpace2D_bd8j1")
states/idle/position = Vector2(329, 108)
states/melee/node = SubResource("AnimationNodeBlendSpace1D_dc3kp")
states/melee/position = Vector2(425, 213)
states/melee/position = Vector2(329, 224)
states/walk/node = SubResource("AnimationNodeBlendSpace2D_vunsg")
states/walk/position = Vector2(520, 108)
transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition_akmuq"), "idle", "walk", SubResource("AnimationNodeStateMachineTransition_sn1tm"), "walk", "idle", SubResource("AnimationNodeStateMachineTransition_5i3fu"), "idle", "melee", SubResource("AnimationNodeStateMachineTransition_y8p74"), "melee", "idle", SubResource("AnimationNodeStateMachineTransition_l17k0")]
graph_offset = Vector2(-129, 11)
transitions = ["Start", "idle", SubResource("AnimationNodeStateMachineTransition_akmuq"), "idle", "walk", SubResource("AnimationNodeStateMachineTransition_sn1tm"), "walk", "idle", SubResource("AnimationNodeStateMachineTransition_5i3fu"), "idle", "melee", SubResource("AnimationNodeStateMachineTransition_y8p74"), "melee", "idle", SubResource("AnimationNodeStateMachineTransition_l17k0"), "hurt", "idle", SubResource("AnimationNodeStateMachineTransition_ln3pc")]
graph_offset = Vector2(-222, -37)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_vm050"]
radius = 8.0
@ -1493,10 +2051,11 @@ libraries = {
libraries = {
"": SubResource("AnimationLibrary_prr1g")
}
tree_root = SubResource("AnimationNodeStateMachine_b0avg")
tree_root = SubResource("AnimationNodeStateMachine_b2867")
anim_player = NodePath("../AnimationPlayer")
parameters/conditions/is_moving = false
parameters/conditions/melee = false
parameters/hurt/blend_position = Vector2(0.949916, -0.0132159)
parameters/idle/blend_position = Vector2(-0.0243112, 0.73545)
parameters/melee/blend_position = 0.0
parameters/melee/0/blend_position = Vector2(0.66778, -0.765217)
@ -1525,8 +2084,9 @@ collision_mask = 2
input_pickable = false
[node name="Collider" type="CollisionShape2D" parent="Attackbox"]
position = Vector2(8, -15)
position = Vector2(0, -10)
shape = SubResource("CircleShape2D_md645")
disabled = true
debug_color = Color(0.745098, 0.462745, 0, 0.419608)
[connection signal="area_entered" from="Attackbox" to="." method="_on_attackbox_area_entered"]

15
Scripts/hiro_ai.gd Normal file
View file

@ -0,0 +1,15 @@
extends CharacterBody2D
@export var health = 100
signal got_hurt(damage: int, attack_direction: Vector2)
signal defeated
func _on_player_attack_did_hit(other, attack_power, attack_direction: Vector2):
if other.get_parent().get_instance_id() == get_instance_id() :
got_hurt.emit(attack_power, attack_direction)
func _on_health_depleted():
defeated.emit()
queue_free()

21
Scripts/hiro_brain.gd Normal file
View file

@ -0,0 +1,21 @@
extends Node
@onready var health = $"..".health
@onready var anim_tree: AnimationTree = $".."/AnimationTree
@onready var anim_playback: AnimationNodeStateMachinePlayback = anim_tree["parameters/playback"]
signal health_depleted
func _on_ai_got_hurt(damage, attack_direction):
var facing_direction = attack_direction * -1
health = health - damage
if health <= 0:
health_depleted.emit()
else:
anim_tree.set("parameters/idle/blend_position", facing_direction)
anim_tree.set("parameters/walk/blend_position", facing_direction)
anim_tree.set("parameters/melee/0/blend_position", facing_direction)
anim_tree.set("parameters/melee/1/blend_position", facing_direction)
anim_tree.set("parameters/melee/2/blend_position", facing_direction)
anim_tree.set("parameters/hurt/blend_position", facing_direction)
anim_playback.travel("hurt")

View file

@ -4,7 +4,8 @@ extends CharacterBody2D
var last_dpad: Array[Vector2] = [Vector2.ZERO,Vector2.ZERO]
const FACING_ANGLE_EPSILON = 15
signal attack_did_hit(other: Area2D)
signal attack_did_hit(other: Area2D, power: int, attack_direction: Vector2)
signal defeated
func _process(_delta):
if Input.is_action_pressed("melee") and $AnimationTree.get("parameters/conditions/melee") == false:
@ -56,4 +57,9 @@ func get_input():
func _on_attackbox_area_entered(area: Area2D):
attack_did_hit.emit(area)
var attack_vector: Vector2 = $AnimationTree.get("parameters/melee/0/blend_position")
attack_did_hit.emit(area, 15, attack_vector)
func _on_hiro_dummy_defeated():
print("Yaaaaay!!")

View file

@ -3,7 +3,7 @@
[ext_resource type="PackedScene" uid="uid://di21xheryhp0k" path="res://Hiro/hiro_player.tscn" id="1_c1gpq"]
[ext_resource type="PackedScene" uid="uid://b8sfype1vx5ad" path="res://Nem/nem_npc.tscn" id="1_sqt7d"]
[ext_resource type="Texture2D" uid="uid://b40la2vyf4rn6" path="res://world/Fighting Dojo BG.png" id="4_elb6q"]
[ext_resource type="Script" path="res://Scripts/reed_player.gd" id="5_df088"]
[ext_resource type="PackedScene" uid="uid://dd2km6qhpdicx" path="res://Hiro/hiro_ai.tscn" id="5_r7nw4"]
[ext_resource type="PackedScene" uid="uid://bakb5a7xe4qby" path="res://Reed/reed_player.tscn" id="6_cn8e2"]
[node name="Node2D" type="Node2D"]
@ -32,10 +32,9 @@ position = Vector2(-1341, -243)
scale = Vector2(8.83789, 4.22585)
polygon = PackedVector2Array(157.843, 76.9076, 161.464, 75.961, 172.213, 75.7244, 176.513, 76.9076, 179.22, 82.4429, 180.012, 85.7558, 180.238, 91.9084, 180.012, 107.053, 178.549, 113.823, 176.739, 116.426, 175.042, 118.083, 169.497, 118.319, 169.497, 123.525, 164.745, 123.525, 164.858, 118.319, 158.975, 117.846, 157.504, 116.663, 155.806, 114.533, 154.109, 108.617, 154.109, 94.4188, 154.222, 83.2968, 152.186, 83.0602, 152.412, 80.9304, 146.181, 70.3743, 139.513, 85.4266, 135.779, 90.8692, 147.66, 124.945, 187.367, 125.038, 195.514, 91.4351, 192.232, 66.1148, 173.676, 53.3363, 157.382, 53.8096, 152.404, 63.2751, 153.317, 81.6403, 154.222, 83.7701, 155.92, 79.9839)
[node name="HiroDummy" parent="." instance=ExtResource("1_c1gpq")]
modulate = Color(0.603922, 0.603922, 0.603922, 1)
position = Vector2(139, 203)
script = ExtResource("5_df088")
[node name="HiroDummy" parent="." instance=ExtResource("5_r7nw4")]
position = Vector2(138, 216)
[connection signal="attack_did_hit" from="HiroPlayer" to="ReedPlayer" method="_on_player_attack_did_hit"]
[connection signal="attack_did_hit" from="HiroPlayer" to="HiroDummy" method="_on_player_attack_did_hit"]
[connection signal="defeated" from="HiroDummy" to="HiroPlayer" method="_on_hiro_dummy_defeated"]