Add ranging attack state for Reed

This commit is contained in:
Mario Martínez 2024-10-27 17:01:12 +01:00
parent 25d21ceb9e
commit 894f0f16e5
6 changed files with 669 additions and 19 deletions

BIN
Reed/Reed_Shooting_Sprite.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://84aonixufbg5"
path="res://.godot/imported/Reed_Shooting_Sprite.png-838a9aca42835ed00963804fbd4b02a8.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Reed/Reed_Shooting_Sprite.png"
dest_files=["res://.godot/imported/Reed_Shooting_Sprite.png-838a9aca42835ed00963804fbd4b02a8.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,4 +1,4 @@
[gd_scene load_steps=63 format=3 uid="uid://bwrwh5of0jw4a"]
[gd_scene load_steps=70 format=3 uid="uid://bwrwh5of0jw4a"]
[ext_resource type="Script" path="res://Scripts/hiro_ai.gd" id="1_yavbv"]
[ext_resource type="Shader" uid="uid://bcnip762rd6yj" path="res://Shaders/character.tres" id="2_y6nd7"]
@ -167,6 +167,29 @@ blend_point_2/node = SubResource("AnimationNodeBlendSpace2D_mr7t3")
blend_point_2/pos = 1.0
blend_mode = 1
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_taa1v"]
animation = &"range_south"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_sxqbg"]
animation = &"range_north"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ld7s8"]
animation = &"range_west"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_csipv"]
animation = &"range_east"
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_ywu4e"]
blend_point_0/node = SubResource("AnimationNodeAnimation_taa1v")
blend_point_0/pos = Vector2(0, 1)
blend_point_1/node = SubResource("AnimationNodeAnimation_sxqbg")
blend_point_1/pos = Vector2(0, -1)
blend_point_2/node = SubResource("AnimationNodeAnimation_ld7s8")
blend_point_2/pos = Vector2(-1, 0)
blend_point_3/node = SubResource("AnimationNodeAnimation_csipv")
blend_point_3/pos = Vector2(1, 0)
blend_mode = 1
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_17wsb"]
animation = &"walking_north"
@ -217,6 +240,14 @@ advance_mode = 2
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ufuqv"]
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_w4gie"]
advance_mode = 2
advance_condition = &"range"
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_b0avg"]
allow_transition_to_self = true
states/End/position = Vector2(1026, 108)
@ -228,15 +259,17 @@ states/defeated/position = Vector2(734, 202)
states/defeated_loop/node = SubResource("AnimationNodeAnimation_0ny5g")
states/defeated_loop/position = Vector2(895, 202)
states/hurt/node = SubResource("AnimationNodeBlendSpace2D_h2vkc")
states/hurt/position = Vector2(329, -13)
states/hurt/position = Vector2(329, -9)
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/melee/position = Vector2(257, 226)
states/range_attack/node = SubResource("AnimationNodeBlendSpace2D_ywu4e")
states/range_attack/position = Vector2(424, 226)
states/walk/node = SubResource("AnimationNodeBlendSpace2D_vunsg")
states/walk/position = Vector2(519, 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"), "defeated", "defeated_loop", SubResource("AnimationNodeStateMachineTransition_l5ng5")]
graph_offset = Vector2(-62, -29)
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", "defeated_loop", SubResource("AnimationNodeStateMachineTransition_l5ng5"), "range_attack", "idle", SubResource("AnimationNodeStateMachineTransition_ufuqv"), "idle", "range_attack", SubResource("AnimationNodeStateMachineTransition_w4gie")]
graph_offset = Vector2(-86, 54)
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_vm050"]
radius = 9.0
@ -280,16 +313,19 @@ libraries = {
tree_root = SubResource("AnimationNodeStateMachine_b0avg")
parameters/conditions/is_moving = false
parameters/conditions/melee = false
parameters/conditions/range = false
parameters/cut_walk/blend_position = Vector2(0.116751, -1.05556)
parameters/hurt/blend_position = Vector2(0, -0.873016)
parameters/idle/blend_position = Vector2(-0.0197802, 0.62963)
parameters/idle/blend_position = Vector2(-0.0152672, 0.85022)
parameters/melee/blend_position = 0.0
parameters/melee/0/blend_position = Vector2(0.000877976, 0.862434)
parameters/melee/1/blend_position = Vector2(-0.218698, 0.0434783)
parameters/melee/2/blend_position = Vector2(0, 0)
parameters/walk/blend_position = Vector2(-0.0021978, 0.78836)
parameters/range_attack/blend_position = Vector2(0.910305, -0.026455)
parameters/walk/blend_position = Vector2(-0.30916, 0.693122)
[node name="Hitbox" type="Area2D" parent="."]
visible = false
position = Vector2(0, 1)
collision_layer = 2
collision_mask = 10
@ -305,6 +341,7 @@ 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
@ -317,6 +354,7 @@ 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"]
@ -352,6 +390,12 @@ to = NodePath("../../Melee")
event = &"will_melee"
delay_in_seconds = "0.0"
[node name="ToAlign" type="Node" parent="StateMachine/Root/Think"]
script = ExtResource("8_713tw")
to = NodePath("../../AlignForRange")
event = &"wants_torange"
delay_in_seconds = "0.0"
[node name="ToApproach" type="Node" parent="StateMachine/Root/Think"]
script = ExtResource("8_713tw")
to = NodePath("../../Approach")
@ -387,6 +431,12 @@ to = NodePath("../../Melee")
event = &"will_melee"
delay_in_seconds = "0.0"
[node name="ToAlign" type="Node" parent="StateMachine/Root/Approach"]
script = ExtResource("8_713tw")
to = NodePath("../../AlignForRange")
event = &"will_range"
delay_in_seconds = "0.0"
[node name="ToThink" type="Node" parent="StateMachine/Root/Approach"]
script = ExtResource("8_713tw")
to = NodePath("../../Think")
@ -414,7 +464,7 @@ to = NodePath("../../Melee")
event = &"will_melee"
delay_in_seconds = "0.0"
[node name="ToThink" type="Node" parent="StateMachine/Root/Chase"]
[node name="ToAlign" type="Node" parent="StateMachine/Root/Chase"]
script = ExtResource("8_713tw")
to = NodePath("../../Think")
event = &"melee_aborted"
@ -471,6 +521,60 @@ to = NodePath("../../Think")
event = &"hurt_complete"
delay_in_seconds = "0.0"
[node name="AlignForRange" type="Node" parent="StateMachine/Root"]
script = ExtResource("7_jc1pg")
[node name="ToVictory" type="Node" parent="StateMachine/Root/AlignForRange"]
script = ExtResource("8_713tw")
to = NodePath("../../Victory")
event = &"has_won"
delay_in_seconds = "0.0"
[node name="ToHurt" type="Node" parent="StateMachine/Root/AlignForRange"]
script = ExtResource("8_713tw")
to = NodePath("../../Hurt")
event = &"been_hurt"
delay_in_seconds = "0.0"
[node name="ToRange" type="Node" parent="StateMachine/Root/AlignForRange"]
script = ExtResource("8_713tw")
to = NodePath("../../Range")
event = &"will_range"
delay_in_seconds = "0.0"
[node name="ToApproach" type="Node" parent="StateMachine/Root/AlignForRange"]
script = ExtResource("8_713tw")
to = NodePath("../../Approach")
event = &"will_melee"
delay_in_seconds = "0.0"
[node name="ToThink" type="Node" parent="StateMachine/Root/AlignForRange"]
script = ExtResource("8_713tw")
to = NodePath("../../Think")
event = &"range_aborted"
delay_in_seconds = "0.0"
[node name="Range" type="Node" parent="StateMachine/Root"]
script = ExtResource("7_jc1pg")
[node name="ToVictory" type="Node" parent="StateMachine/Root/Range"]
script = ExtResource("8_713tw")
to = NodePath("../../Victory")
event = &"has_won"
delay_in_seconds = "0.0"
[node name="ToHurt" type="Node" parent="StateMachine/Root/Range"]
script = ExtResource("8_713tw")
to = NodePath("../../Hurt")
event = &"been_hurt"
delay_in_seconds = "0.0"
[node name="ToThink" type="Node" parent="StateMachine/Root/Range"]
script = ExtResource("8_713tw")
to = NodePath("../../Think")
event = &"range_complete"
delay_in_seconds = "0.0"
[node name="Defeat" type="Node" parent="StateMachine/Root"]
script = ExtResource("7_jc1pg")
@ -490,7 +594,7 @@ script = ExtResource("7_jc1pg")
[connection signal="state_entered" from="StateMachine/Root/Chase" to="." method="_on_chase_state_entered"]
[connection signal="state_exited" from="StateMachine/Root/Chase" to="." method="_on_chase_state_exited"]
[connection signal="state_processing" from="StateMachine/Root/Chase" to="." method="_on_chase_state_processing"]
[connection signal="taken" from="StateMachine/Root/Chase/ToThink" to="." method="_on_chase_to_think_taken"]
[connection signal="taken" from="StateMachine/Root/Chase/ToAlign" to="." method="_on_chase_to_range_taken"]
[connection signal="state_entered" from="StateMachine/Root/Melee" to="." method="_on_melee_state_entered"]
[connection signal="state_exited" from="StateMachine/Root/Melee" to="." method="_on_melee_state_exited"]
[connection signal="state_processing" from="StateMachine/Root/Melee" to="." method="_on_melee_state_processing"]
@ -498,5 +602,10 @@ script = ExtResource("7_jc1pg")
[connection signal="state_exited" from="StateMachine/Root/Hurt" to="." method="_on_hurt_state_exited"]
[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/AlignForRange" to="." method="_on_align_for_range_state_entered"]
[connection signal="state_exited" from="StateMachine/Root/AlignForRange" to="." method="_on_align_for_range_state_exited"]
[connection signal="state_processing" from="StateMachine/Root/AlignForRange" to="." method="_on_align_for_range_state_processing"]
[connection signal="state_entered" from="StateMachine/Root/Range" to="." method="_on_range_state_entered"]
[connection signal="state_exited" from="StateMachine/Root/Range" to="." method="_on_range_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,10 +1,11 @@
[gd_resource type="AnimationLibrary" load_steps=35 format=3 uid="uid://bhg3cnhjeq85r"]
[gd_resource type="AnimationLibrary" load_steps=40 format=3 uid="uid://bhg3cnhjeq85r"]
[ext_resource type="Texture2D" uid="uid://pittqsk5eskq" path="res://Reed/Reed Walk Sprite Cycle Line Up.png" id="1_4xts1"]
[ext_resource type="Texture2D" uid="uid://clbdgd8f7isb4" path="res://Reed/Reed_Reed_Defeated_Sprite_.png" id="2_7ny10"]
[ext_resource type="Texture2D" uid="uid://c7q83hvbvaifu" path="res://Reed/Reed_Hurt_Sprites.png" id="3_ynckf"]
[ext_resource type="Texture2D" uid="uid://bmix77hgm7q21" path="res://Reed/Reed_Idle_Blink_Sprites.png" id="4_peeea"]
[ext_resource type="Texture2D" uid="uid://ctajre4ylwoqp" path="res://Reed/Reed_Melee_Sprites_Y.png" id="4_uq1j6"]
[ext_resource type="Texture2D" uid="uid://84aonixufbg5" path="res://Reed/Reed_Shooting_Sprite.png" id="6_mmn82"]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_m3ug4"]
height = 20.0
@ -1879,6 +1880,454 @@ tracks/6/keys = {
"values": [Vector2(0, -11), Vector2(-4, -14), Vector2(12, -11), Vector2(-4, -14), Vector2(-0.00060463, -11)]
}
[sub_resource type="Animation" id="Animation_fx2sq"]
resource_name = "range_east"
length = 0.60001
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("6_mmn82")]
}
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": [4]
}
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("AnimationTree:parameters/conditions/melee")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Attackbox/Collider:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.0666667),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, -10), Vector2(0, -14)]
}
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),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Sprite2D:material:shader_parameter/FlashColor")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 0, 0, 0)]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("Sprite2D:frame")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [5, 6, 7, 6]
}
tracks/8/type = "value"
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/path = NodePath("Attackbox/Collider:shape")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [SubResource("CapsuleShape2D_m3ug4")]
}
[sub_resource type="Animation" id="Animation_i76f3"]
resource_name = "range_north"
length = 0.60001
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("6_mmn82")]
}
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": [4]
}
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("AnimationTree:parameters/conditions/melee")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Attackbox/Collider:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.0666667),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, -10), Vector2(0, -14)]
}
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),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Sprite2D:material:shader_parameter/FlashColor")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 0, 0, 0)]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("Sprite2D:frame")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [9, 10, 11, 10]
}
tracks/8/type = "value"
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/path = NodePath("Attackbox/Collider:shape")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [SubResource("CapsuleShape2D_m3ug4")]
}
[sub_resource type="Animation" id="Animation_00yeq"]
resource_name = "range_south"
length = 0.60001
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("6_mmn82")]
}
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": [4]
}
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("AnimationTree:parameters/conditions/melee")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Attackbox/Collider:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.0666667),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, -10), Vector2(0, -14)]
}
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),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Sprite2D:material:shader_parameter/FlashColor")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 0, 0, 0)]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("Sprite2D:frame")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [1, 2, 3, 2]
}
tracks/8/type = "value"
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/path = NodePath("Attackbox/Collider:shape")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [SubResource("CapsuleShape2D_m3ug4")]
}
[sub_resource type="Animation" id="Animation_8ftbb"]
resource_name = "range_west"
length = 0.60001
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("6_mmn82")]
}
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": [4]
}
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("AnimationTree:parameters/conditions/melee")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Attackbox/Collider:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.0666667),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, -10), Vector2(0, -14)]
}
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),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Sprite2D:material:shader_parameter/FlashColor")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 0, 0, 0)]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("Sprite2D:frame")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [13, 14, 15, 14]
}
tracks/8/type = "value"
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/path = NodePath("Attackbox/Collider:shape")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [SubResource("CapsuleShape2D_m3ug4")]
}
[sub_resource type="Animation" id="Animation_de3xn"]
resource_name = "walking_east"
length = 0.500013
@ -2121,6 +2570,10 @@ _data = {
"punch_south_rigth": SubResource("Animation_bw220"),
"punch_west_left": SubResource("Animation_wjl2t"),
"punch_west_rigth": SubResource("Animation_e4rxs"),
"range_east": SubResource("Animation_fx2sq"),
"range_north": SubResource("Animation_i76f3"),
"range_south": SubResource("Animation_00yeq"),
"range_west": SubResource("Animation_8ftbb"),
"walking_east": SubResource("Animation_de3xn"),
"walking_north": SubResource("Animation_bg701"),
"walking_south": SubResource("Animation_sroq6"),

View file

@ -7,6 +7,7 @@ extends CharacterBase
@export var MELEE_RADIUS = 75
@export var chase_speed = 65
@export var approach_speed = 40
@export var align_speed = 40
@export var min_recoil_time = 3.0/60.0
@export var max_recoil_time = 1.0
@export var reduce_recoil_time_threshold = 58.0/60.0
@ -42,12 +43,40 @@ func set_animation_direction(facing_direction: Vector2):
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_tree.set("parameters/range_attack/blend_position", facing_direction)
anim_tree.set("parameters/cut_walk/blend_position", facing_direction)
func follow_player(speed: float):
var approach_direction = global_position.direction_to(player_character.global_position)
velocity = speed * approach_direction
set_animation_direction(approach_direction)
func align_with_player(speed: float):
var vector_to_player = player_character.global_position - global_position
var movement_direction: Vector2
var dist = 0.0
if abs(vector_to_player.y) < abs(vector_to_player.x):
# Moving vertically
dist = abs(vector_to_player.y) - 1.0
if dist <= 0:
# Aligned
state_machine.send_event("will_range")
set_animation_direction(vector_to_player.normalized())
return
else:
movement_direction = Vector2.DOWN if vector_to_player.y > 0.0 else Vector2.UP
else:
# Moving horizontally
dist = abs(vector_to_player.x) - 1.0
if dist <= 0:
# Aligned
state_machine.send_event("will_range")
set_animation_direction(vector_to_player.normalized())
return
else:
movement_direction = Vector2.RIGHT if vector_to_player.x > 0.0 else Vector2.LEFT
velocity = movement_direction * speed
set_animation_direction(movement_direction)
func _physics_process(delta: float):
super._physics_process(delta)
@ -86,9 +115,9 @@ func _on_think_state_processing(delta):
## This function actually determines what to do
func do_thinking():
var distance = position.distance_to(player_character.position)
if distance > MELEE_RADIUS:
if distance >= MELEE_RADIUS:
state_machine.set_expression_property("melee_stage", 0)
# range attacks here
state_machine.send_event("wants_torange")
else:
state_machine.send_event("wants_tomelee")
@ -149,6 +178,8 @@ func _on_hurt_reposition_state_exited():
func _on_animation_tree_animation_finished(anim_name):
if anim_name.contains("hurt"):
state_machine.send_event("hurt_complete")
elif anim_name.contains("range"):
state_machine.send_event("range_complete")
elif (anim_name.contains("kick") or anim_name.contains("punch")):
attack_counter = attack_counter + 1
wants_to_melee = wants_to_melee and attack_counter < attack_counter_limit
@ -175,6 +206,9 @@ func _on_approach_state_entered():
func _on_approach_state_processing(delta):
timer -= delta
if timer < 0:
var distance = global_position.distance_to(player_character.global_position)
if distance >= MELEE_RADIUS:
state_machine.send_event("wants_torange")
state_machine.send_event("approach_complete")
@ -200,7 +234,7 @@ func _on_chase_state_exited():
anim_tree.set("parameters/conditions/is_moving", false)
velocity = Vector2.ZERO
func _on_chase_to_think_taken():
func _on_chase_to_range_taken():
state_machine.set_expression_property("melee_stage", 0)
## Melee
@ -237,3 +271,22 @@ func _on_victory_state_entered():
func _on_player_been_defeated():
state_machine.send_event("has_won")
func _on_align_for_range_state_entered():
anim_tree.set("parameters/conditions/is_moving", true)
func _on_align_for_range_state_exited():
anim_tree.set("parameters/conditions/is_moving", false)
func _on_align_for_range_state_processing(delta):
align_with_player(align_speed)
var distance = position.distance_to(player_character.position)
if distance < MELEE_RADIUS:
state_machine.send_event("will_melee")
func _on_range_state_entered():
velocity = Vector2.ZERO
anim_tree.set("parameters/conditions/range", true)
func _on_range_state_exited():
anim_tree.set("parameters/conditions/range", false)

View file

@ -6,7 +6,7 @@
[ext_resource type="FontFile" uid="uid://bgqotudi6bifk" path="res://UI/Gundam 00 font gaufont.ttf" id="2_64thh"]
[ext_resource type="Script" path="res://Scripts/UI/pause_menu.gd" id="2_nw73f"]
[ext_resource type="PackedScene" uid="uid://bcwkugn6v3oy7" path="res://addons/godot_state_charts/utilities/state_chart_debugger.tscn" id="2_o5str"]
[ext_resource type="Resource" uid="uid://bj3rm1r1ouq0r" path="res://Cutscenes/prototype_start.tres" id="3_i6m8h"]
[ext_resource type="Resource" uid="uid://ck75kipijh0fn" path="res://Cutscenes/prototype_clone_victory.tres" id="3_f8ahk"]
[ext_resource type="Texture2D" uid="uid://b40la2vyf4rn6" path="res://world/Fighting Dojo BG.png" id="4_elb6q"]
[ext_resource type="Texture2D" uid="uid://dc12iaho4b8yl" path="res://world/walls.png" id="7_pp5dn"]
[ext_resource type="PackedScene" uid="uid://c503u0i421w34" path="res://world/pillar.tscn" id="8_mxq55"]
@ -128,7 +128,7 @@ script = ExtResource("1_y634h")
[node name="CutsceneManager" type="Node" parent="."]
script = ExtResource("19_5yvrq")
cutscene = ExtResource("3_i6m8h")
cutscene = ExtResource("3_f8ahk")
[node name="MusicManager" parent="." instance=ExtResource("24_03wyf")]
@ -231,7 +231,6 @@ layout_mode = 1
[node name="BattleUI" parent="CanvasLayer" instance=ExtResource("10_hxn8m")]
[node name="Debug" type="Control" parent="CanvasLayer"]
visible = false
layout_mode = 3
anchor_left = 0.667
anchor_right = 1.0
@ -245,7 +244,6 @@ offset_right = 81.24
offset_bottom = 155.0
scale = Vector2(0.75, 0.75)
size_flags_horizontal = 0
enabled = false
initial_node_to_watch = NodePath("../../../ReedAI")
[node name="MapElements" type="Node2D" parent="."]
@ -308,7 +306,7 @@ has_nsfw_animations = false
[node name="Camera2D" type="Camera2D" parent="HiroPlayer"]
texture_filter = 1
zoom = Vector2(3, 3)
zoom = Vector2(2, 2)
position_smoothing_enabled = true
position_smoothing_speed = 3.0
script = ExtResource("16_6jycw")
@ -333,7 +331,7 @@ attack_power = 10
position = Vector2(-55, 283)
player_character = NodePath("../HiroPlayer")
KNOCKBACK_REPOSITION_POWER = 90
MELEE_RADIUS = 300
MELEE_RADIUS = 105
reduce_recoil_time_threshold = 0.75
max_health = 400
health = 400