Compare commits

...

4 commits

11 changed files with 507 additions and 37 deletions

BIN
Hiro/Hiro Defeated Nude Sprites Line.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://byc7mqu65fb4a"
path="res://.godot/imported/Hiro Defeated Nude Sprites Line.png-8ce27add5678a69dee590136bd2ef3a5.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Hiro/Hiro Defeated Nude Sprites Line.png"
dest_files=["res://.godot/imported/Hiro Defeated Nude Sprites Line.png-8ce27add5678a69dee590136bd2ef3a5.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
Hiro/Hiro Defeated Sprites nb.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://06a1bf8kjte6"
path="res://.godot/imported/Hiro Defeated Sprites nb.png-0498112418d31b8cab02894cf6c9c734.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Hiro/Hiro Defeated Sprites nb.png"
dest_files=["res://.godot/imported/Hiro Defeated Sprites nb.png-0498112418d31b8cab02894cf6c9c734.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=53 format=3 uid="uid://dd2km6qhpdicx"]
[gd_scene load_steps=61 format=3 uid="uid://dd2km6qhpdicx"]
[ext_resource type="Script" path="res://Scripts/hiro_ai.gd" id="1_inmen"]
[ext_resource type="Shader" uid="uid://bcnip762rd6yj" path="res://Shaders/character.tres" id="2_6u0oh"]
[ext_resource type="Texture2D" uid="uid://cm7tgomrcvq30" path="res://Hiro/Hiro Walk Sprite Cycle Line Up.png" id="2_ctdbh"]
[ext_resource type="AnimationLibrary" uid="uid://dincs5x4qucal" path="res://Hiro/hiro_animation.tres" id="3_umwtx"]
[ext_resource type="Script" path="res://addons/godot_state_charts/state_chart.gd" id="6_i4c04"]
@ -9,6 +10,13 @@
[ext_resource type="Script" path="res://addons/godot_state_charts/expression_guard.gd" id="9_ak1rc"]
[ext_resource type="Script" path="res://addons/godot_state_charts/transition.gd" id="9_la16b"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_7ckhc"]
shader = ExtResource("2_6u0oh")
shader_parameter/FlashColor = Color(1, 0, 0, 0)
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8ov0j"]
animation = &"player_defeated"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_tyc74"]
animation = &"hurt_west"
@ -133,6 +141,12 @@ blend_point_2/node = SubResource("AnimationNodeBlendSpace2D_mr7t3")
blend_point_2/pos = 1.0
blend_mode = 1
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_0ny5g"]
animation = &"ai_defeated"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_kgin3"]
animation = &"ai_defeated_start"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_17wsb"]
animation = &"walking_north"
@ -179,19 +193,38 @@ advance_mode = 2
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_l5ng5"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_86ydq"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_yav5y"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_b0avg"]
allow_transition_to_self = true
states/End/position = Vector2(1026, 108)
states/Start/position = Vector2(197, 108)
states/defeated/node = SubResource("AnimationNodeAnimation_8ov0j")
states/defeated/position = Vector2(734, 74)
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(329, 224)
states/naked/node = SubResource("AnimationNodeAnimation_0ny5g")
states/naked/position = Vector2(895, 202)
states/naked_start/node = SubResource("AnimationNodeAnimation_kgin3")
states/naked_start/position = Vector2(734, 202)
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"), "hurt", "idle", SubResource("AnimationNodeStateMachineTransition_ln3pc")]
graph_offset = Vector2(-141, 47)
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"), "naked_start", "naked", SubResource("AnimationNodeStateMachineTransition_l5ng5"), "defeated", "End", SubResource("AnimationNodeStateMachineTransition_86ydq"), "naked", "End", SubResource("AnimationNodeStateMachineTransition_yav5y")]
graph_offset = Vector2(273, 34)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_vm050"]
radius = 8.0
@ -223,6 +256,7 @@ script = ExtResource("1_inmen")
[node name="Sprite2D" type="Sprite2D" parent="."]
modulate = Color(0.498039, 0.498039, 0.498039, 1)
texture_filter = 1
material = SubResource("ShaderMaterial_7ckhc")
position = Vector2(0, -13)
texture = ExtResource("2_ctdbh")
hframes = 20
@ -243,6 +277,7 @@ parameters/melee/2/blend_position = Vector2(0, 0)
parameters/walk/blend_position = Vector2(-0.0100167, -0.0729166)
[node name="Hitbox" type="Area2D" parent="."]
visible = false
position = Vector2(0, 1)
collision_layer = 2
collision_mask = 10
@ -253,25 +288,30 @@ shape = SubResource("CapsuleShape2D_vm050")
debug_color = Color(1, 0.133333, 0.321569, 0.419608)
[node name="MovementCollider" type="CollisionShape2D" parent="."]
visible = false
position = Vector2(-0.5, -1)
shape = SubResource("RectangleShape2D_bdqvd")
[node name="Attackbox" type="Area2D" parent="."]
visible = false
position = Vector2(0, 1)
collision_layer = 8
collision_mask = 2
input_pickable = false
[node name="Collider" type="CollisionShape2D" parent="Attackbox"]
visible = false
position = Vector2(0, -10)
shape = SubResource("CircleShape2D_md645")
disabled = true
debug_color = Color(0.745098, 0.462745, 0, 0.419608)
[node name="Meleebox" type="Area2D" parent="."]
visible = false
collision_layer = 4
[node name="DetectionArea" type="CollisionShape2D" parent="Meleebox"]
visible = false
position = Vector2(0, -13)
shape = SubResource("CapsuleShape2D_hxosv")
debug_color = Color(0.784314, 0.423529, 0.27451, 0.419608)
@ -286,6 +326,12 @@ initial_state = NodePath("Think")
[node name="Think" type="Node" parent="StateMachine/Root"]
script = ExtResource("8_pqyhf")
[node name="ToVictory" type="Node" parent="StateMachine/Root/Think"]
script = ExtResource("9_la16b")
to = NodePath("../../Victory")
event = &"has_won"
delay_in_seconds = "0.0"
[node name="ToHurt" type="Node" parent="StateMachine/Root/Think"]
script = ExtResource("9_la16b")
to = NodePath("../../Hurt")
@ -315,6 +361,12 @@ delay_in_seconds = "0.0"
[node name="Approach" type="Node" parent="StateMachine/Root"]
script = ExtResource("8_pqyhf")
[node name="ToVictory" type="Node" parent="StateMachine/Root/Approach"]
script = ExtResource("9_la16b")
to = NodePath("../../Victory")
event = &"has_won"
delay_in_seconds = "0.0"
[node name="ToHurt" type="Node" parent="StateMachine/Root/Approach"]
script = ExtResource("9_la16b")
to = NodePath("../../Hurt")
@ -336,6 +388,12 @@ delay_in_seconds = "0.0"
[node name="Chase" type="Node" parent="StateMachine/Root"]
script = ExtResource("8_pqyhf")
[node name="ToVictory" type="Node" parent="StateMachine/Root/Chase"]
script = ExtResource("9_la16b")
to = NodePath("../../Victory")
event = &"has_won"
delay_in_seconds = "0.0"
[node name="ToHurt" type="Node" parent="StateMachine/Root/Chase"]
script = ExtResource("9_la16b")
to = NodePath("../../Hurt")
@ -357,6 +415,12 @@ delay_in_seconds = "0.0"
[node name="Melee" type="Node" parent="StateMachine/Root"]
script = ExtResource("8_pqyhf")
[node name="ToVictory" type="Node" parent="StateMachine/Root/Melee"]
script = ExtResource("9_la16b")
to = NodePath("../../Victory")
event = &"has_won"
delay_in_seconds = "0.0"
[node name="ToHurt" type="Node" parent="StateMachine/Root/Melee"]
script = ExtResource("9_la16b")
to = NodePath("../../Hurt")
@ -402,6 +466,9 @@ delay_in_seconds = "0.0"
[node name="Defeat" type="Node" parent="StateMachine/Root"]
script = ExtResource("8_pqyhf")
[node name="Victory" type="Node" parent="StateMachine/Root"]
script = ExtResource("8_pqyhf")
[connection signal="animation_finished" from="AnimationTree" to="." method="_on_animation_tree_animation_finished"]
[connection signal="area_entered" from="Attackbox" to="." method="_on_attackbox_area_entered"]
[connection signal="body_entered" from="Meleebox" to="." method="_on_meleebox_body_entered"]
@ -424,3 +491,4 @@ script = ExtResource("8_pqyhf")
[connection signal="state_entered" from="StateMachine/Root/HurtReposition" to="." method="_on_hurt_reposition_state_entered"]
[connection signal="state_exited" from="StateMachine/Root/HurtReposition" to="." method="_on_hurt_reposition_state_exited"]
[connection signal="state_entered" from="StateMachine/Root/Defeat" to="." method="_on_defeat_state_entered"]
[connection signal="state_entered" from="StateMachine/Root/Victory" to="." method="_on_victory_state_entered"]

View file

@ -1,8 +1,10 @@
[gd_resource type="AnimationLibrary" load_steps=29 format=3 uid="uid://dincs5x4qucal"]
[gd_resource type="AnimationLibrary" load_steps=34 format=3 uid="uid://dincs5x4qucal"]
[ext_resource type="Texture2D" uid="uid://cm7tgomrcvq30" path="res://Hiro/Hiro Walk Sprite Cycle Line Up.png" id="1_hc7kj"]
[ext_resource type="Texture2D" uid="uid://rcidedgcjqg6" path="res://Hiro/Hiro Hurt Sprites.png" id="2_2k6ad"]
[ext_resource type="Texture2D" uid="uid://bio3egs7q7wog" path="res://Hiro/Hiro Melee Sprites.png" id="3_5swnw"]
[ext_resource type="Texture2D" uid="uid://06a1bf8kjte6" path="res://Hiro/Hiro Defeated Sprites nb.png" id="4_fugxd"]
[ext_resource type="Texture2D" uid="uid://byc7mqu65fb4a" path="res://Hiro/Hiro Defeated Nude Sprites Line.png" id="5_0f03l"]
[sub_resource type="Animation" id="Animation_04piu"]
length = 0.001
@ -90,6 +92,18 @@ tracks/6/keys = {
"update": 1,
"values": [true]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("Sprite2D:material:shader_parameter/FlashColor")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 0, 0, 0)]
}
[sub_resource type="Animation" id="Animation_kvnht"]
resource_name = "hurt_east"
@ -143,6 +157,18 @@ tracks/3/keys = {
"update": 1,
"values": [6, 7, 8, 9]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Sprite2D:material:shader_parameter/FlashColor")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 0, 0, 1), Color(1, 0, 0, 0)]
}
[sub_resource type="Animation" id="Animation_fytkh"]
resource_name = "hurt_north"
@ -196,6 +222,18 @@ tracks/3/keys = {
"update": 1,
"values": [10, 11, 12, 13]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Sprite2D:material:shader_parameter/FlashColor")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 0, 0, 1), Color(1, 0, 0, 0)]
}
[sub_resource type="Animation" id="Animation_lw5of"]
resource_name = "hurt_south"
@ -249,6 +287,18 @@ tracks/3/keys = {
"update": 1,
"values": [1, 2, 3, 4]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Sprite2D:material:shader_parameter/FlashColor")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 0, 0, 1), Color(1, 0, 0, 0)]
}
[sub_resource type="Animation" id="Animation_htnmm"]
resource_name = "hurt_west"
@ -302,6 +352,18 @@ tracks/3/keys = {
"update": 1,
"values": [16, 17, 18, 19]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Sprite2D:material:shader_parameter/FlashColor")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 0, 0, 0.987594), Color(1, 0, 0, 0)]
}
[sub_resource type="Animation" id="Animation_3oagy"]
resource_name = "idle_east"
@ -565,7 +627,7 @@ tracks/3/keys = {
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/enabled = false
tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee")
tracks/4/interp = 1
tracks/4/loop_wrap = true
@ -654,7 +716,7 @@ tracks/3/keys = {
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/enabled = false
tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee")
tracks/4/interp = 1
tracks/4/loop_wrap = true
@ -743,7 +805,7 @@ tracks/3/keys = {
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/enabled = false
tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee")
tracks/4/interp = 1
tracks/4/loop_wrap = true
@ -832,7 +894,7 @@ tracks/3/keys = {
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/enabled = false
tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee")
tracks/4/interp = 1
tracks/4/loop_wrap = true
@ -921,7 +983,7 @@ tracks/3/keys = {
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/enabled = false
tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee")
tracks/4/interp = 1
tracks/4/loop_wrap = true
@ -1010,7 +1072,7 @@ tracks/3/keys = {
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/enabled = false
tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee")
tracks/4/interp = 1
tracks/4/loop_wrap = true
@ -1099,7 +1161,7 @@ tracks/3/keys = {
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/enabled = false
tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee")
tracks/4/interp = 1
tracks/4/loop_wrap = true
@ -1188,7 +1250,7 @@ tracks/3/keys = {
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/enabled = false
tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee")
tracks/4/interp = 1
tracks/4/loop_wrap = true
@ -1277,7 +1339,7 @@ tracks/3/keys = {
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/enabled = false
tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee")
tracks/4/interp = 1
tracks/4/loop_wrap = true
@ -1366,7 +1428,7 @@ tracks/3/keys = {
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/enabled = false
tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee")
tracks/4/interp = 1
tracks/4/loop_wrap = true
@ -1455,7 +1517,7 @@ tracks/3/keys = {
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/enabled = false
tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee")
tracks/4/interp = 1
tracks/4/loop_wrap = true
@ -1544,7 +1606,7 @@ tracks/3/keys = {
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/enabled = false
tracks/4/path = NodePath("AnimationTree:parameters/conditions/melee")
tracks/4/interp = 1
tracks/4/loop_wrap = true
@ -1795,9 +1857,194 @@ tracks/3/keys = {
"values": [ExtResource("1_hc7kj")]
}
[sub_resource type="Animation" id="Animation_g1svr"]
resource_name = "player_defeated"
length = 0.83335
step = 0.166667
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_fugxd")]
}
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": [1]
}
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.166667, 0.333333, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [1, 2, 3, 4]
}
[sub_resource type="Animation" id="Animation_ry0wg"]
resource_name = "ai_defeated"
length = 1.00003
step = 0.25
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("5_0f03l")]
}
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": [1]
}
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.25, 0.5, 0.75, 1),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 1,
"values": [1, 2, 3, 4, 0]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Sprite2D:material:shader_parameter/FlashColor")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 0, 0, 0)]
}
[sub_resource type="Animation" id="Animation_d06fy"]
resource_name = "ai_defeated_start"
length = 0.571443
step = 0.142857
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("5_0f03l")]
}
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": [1]
}
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),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Sprite2D:material:shader_parameter/FlashColor")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 0, 0, 0)]
}
[resource]
_data = {
"RESET": SubResource("Animation_04piu"),
"ai_defeated": SubResource("Animation_ry0wg"),
"ai_defeated_start": SubResource("Animation_d06fy"),
"hurt_east": SubResource("Animation_kvnht"),
"hurt_north": SubResource("Animation_fytkh"),
"hurt_south": SubResource("Animation_lw5of"),
@ -1810,6 +2057,7 @@ _data = {
"kick_north": SubResource("Animation_cuaji"),
"kick_south": SubResource("Animation_hqga6"),
"kick_west": SubResource("Animation_s8xim"),
"player_defeated": SubResource("Animation_g1svr"),
"punch_east_left": SubResource("Animation_o0diw"),
"punch_east_rigth": SubResource("Animation_ar6r3"),
"punch_north_left": SubResource("Animation_1e0v6"),

View file

@ -1,9 +1,18 @@
[gd_scene load_steps=45 format=3 uid="uid://di21xheryhp0k"]
[gd_scene load_steps=49 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="Shader" uid="uid://bcnip762rd6yj" path="res://Shaders/character.tres" id="2_tyej0"]
[ext_resource type="AnimationLibrary" uid="uid://dincs5x4qucal" path="res://Hiro/hiro_animation.tres" id="3_ucyqo"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ftlgj"]
resource_local_to_scene = true
shader = ExtResource("2_tyej0")
shader_parameter/FlashColor = Color(1, 0, 0, 0)
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_luptt"]
animation = &"player_defeated"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_tyc74"]
animation = &"hurt_west"
@ -167,16 +176,22 @@ advance_mode = 2
advance_condition = &"melee"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_l17k0"]
switch_mode = 2
advance_mode = 2
advance_expression = "get(\"parameters/conditions/melee\") == false"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ln3pc"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ouche"]
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/defeated/node = SubResource("AnimationNodeAnimation_luptt")
states/defeated/position = Vector2(748, 100)
states/hurt/node = SubResource("AnimationNodeBlendSpace2D_h2vkc")
states/hurt/position = Vector2(329, -13)
states/idle/node = SubResource("AnimationNodeBlendSpace2D_bd8j1")
@ -185,8 +200,8 @@ states/melee/node = SubResource("AnimationNodeBlendSpace1D_dc3kp")
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"), "hurt", "idle", SubResource("AnimationNodeStateMachineTransition_ln3pc")]
graph_offset = Vector2(-258, -59)
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"), "defeated", "End", SubResource("AnimationNodeStateMachineTransition_ouche")]
graph_offset = Vector2(-164, -94)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_vm050"]
radius = 8.0
@ -205,6 +220,7 @@ script = ExtResource("1_dtymi")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 1
material = SubResource("ShaderMaterial_ftlgj")
position = Vector2(0, -13)
texture = ExtResource("1_ukwcc")
hframes = 20

View file

@ -4,6 +4,7 @@ extends CharacterBody2D
@export var player_character: PlayableCharacter
@export var health = 100
@export var attack_power = 30
@export var nsfw = true
@export var KNOCKBACK_POWER = 40
@export var KNOCKBACK_REPOSITION_POWER = 75
@export var KNOCKBACK_RANDOMNESS = 50
@ -108,12 +109,8 @@ func _on_hurt_state_entered():
else:
set_animation_direction(facing_direction)
anim_playback.travel("hurt")
var knockback_variance = Vector2.ZERO
if attacked_from.x != 0:
knockback_variance.y = randf_range(-1, 1) * KNOCKBACK_RANDOMNESS
elif attacked_from.y != 0:
knockback_variance.x = randf_range(-1, 1) * KNOCKBACK_RANDOMNESS
velocity = attacked_from * KNOCKBACK_POWER + knockback_variance
var knockback_direction = attacked_from.rotated(deg_to_rad(randf_range(-1, 1) * KNOCKBACK_RANDOMNESS))
velocity = KNOCKBACK_POWER * knockback_direction.normalized()
state_machine.set_expression_property("melee_stage", 0)
@ -146,7 +143,10 @@ func _on_animation_tree_animation_finished(anim_name):
state_machine.send_event("melee_complete")
func _on_defeat_state_entered():
queue_free()
if nsfw:
anim_playback.travel("naked_start")
else:
anim_playback.travel("defeated")
## Aproaching
func _on_approach_state_entered():
@ -210,3 +210,14 @@ func _on_melee_state_exited():
func _on_attackbox_area_entered(area):
attack_did_hit.emit(area, attack_power, anim_tree.get("parameters/melee/0/blend_position"))
func _on_victory_state_entered():
wants_to_melee = false
anim_tree.set("parameters/conditions/melee", false)
state_machine.set_expression_property("melee_stage", 0)
velocity = Vector2.ZERO
func _on_player_been_defeated():
state_machine.send_event("has_won")

View file

@ -10,6 +10,8 @@ const FACING_ANGLE_EPSILON = 15
var can_move = true
@onready var animation_playback: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback")
signal attack_did_hit(other: Area2D, power: int, attack_direction: Vector2)
signal defeated
@ -82,25 +84,20 @@ func _on_enemy_attack_did_hit(other, power, attack_direction):
health = health - power
can_move = false
if health <= 0:
print("Nooooooooooooo!!")
animation_playback.travel("defeated")
defeated.emit()
velocity = Vector2.ZERO
else:
var facing_direction = attack_direction * -1.0
set_animation_direction(facing_direction)
var knockback_variance = Vector2.ZERO
if attack_direction.x != 0:
knockback_variance.y = randf_range(-1, 1) * KNOCKBACK_RANDOMNESS
elif attack_direction.y != 0:
knockback_variance.x = randf_range(-1, 1) * KNOCKBACK_RANDOMNESS
velocity = KNOCKBACK_POWER * attack_direction + knockback_variance
var playback: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback")
playback.travel("hurt")
var knockback_direction = attack_direction.rotated(deg_to_rad(randf_range(-1, 1) * KNOCKBACK_RANDOMNESS))
velocity = KNOCKBACK_POWER * knockback_direction.normalized()
animation_playback.travel("hurt")
$AnimationTree.set("parameters/conditions/melee", false)
func _on_animation_tree_animation_finished(anim_name):
if anim_name.contains("hurt") or anim_name.contains("kick") or anim_name.contains("punch"):
can_move = true
$AnimationTree.set("parameters/conditions/melee", false)
if anim_name.contains("kick") or anim_name.contains("punch"):
$Attackbox/Collider.set_deferred("disabled", true)

55
Shaders/character.tres Normal file
View file

@ -0,0 +1,55 @@
[gd_resource type="VisualShader" load_steps=4 format=3 uid="uid://bcnip762rd6yj"]
[sub_resource type="VisualShaderNodeColorParameter" id="VisualShaderNodeColorParameter_llme6"]
expanded_output_ports = [0]
parameter_name = "FlashColor"
[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_k72xm"]
expanded_output_ports = [0]
input_name = "color"
[sub_resource type="VisualShaderNodeMix" id="VisualShaderNodeMix_oth8y"]
default_input_values = [0, Vector3(0, 0, 0), 1, Vector3(1, 1, 1), 2, Vector3(0, 0, 0)]
op_type = 3
[resource]
code = "shader_type canvas_item;
render_mode blend_mix;
uniform vec4 FlashColor : source_color;
void fragment() {
// Input:3
vec4 n_out3p0 = COLOR;
float n_out3p4 = n_out3p0.a;
// ColorParameter:2
vec4 n_out2p0 = FlashColor;
float n_out2p4 = n_out2p0.a;
// Mix:4
vec3 n_out4p0 = mix(vec3(n_out3p0.xyz), vec3(n_out2p0.xyz), vec3(n_out2p4));
// Output:0
COLOR.rgb = n_out4p0;
COLOR.a = n_out3p4;
}
"
graph_offset = Vector2(-122.937, -65.8182)
mode = 1
flags/light_only = false
nodes/fragment/0/position = Vector2(600, -60)
nodes/fragment/2/node = SubResource("VisualShaderNodeColorParameter_llme6")
nodes/fragment/2/position = Vector2(-40, 140)
nodes/fragment/3/node = SubResource("VisualShaderNodeInput_k72xm")
nodes/fragment/3/position = Vector2(-60, -60)
nodes/fragment/4/node = SubResource("VisualShaderNodeMix_oth8y")
nodes/fragment/4/position = Vector2(300, 100)
nodes/fragment/connections = PackedInt32Array(3, 4, 0, 1, 3, 0, 4, 0, 2, 0, 4, 1, 4, 0, 0, 0, 2, 4, 4, 2)

View file

@ -47,4 +47,5 @@ player_character = NodePath("../HiroPlayer")
attack_power = 5
[connection signal="attack_did_hit" from="HiroPlayer" to="HiroAI" method="_on_player_attack_did_hit"]
[connection signal="defeated" from="HiroPlayer" to="HiroAI" method="_on_player_been_defeated"]
[connection signal="attack_did_hit" from="HiroAI" to="HiroPlayer" method="_on_enemy_attack_did_hit"]