Set spawner locations for gun blasts and fix Reed not blinking when he loses
This commit is contained in:
parent
4fa8ff6bc3
commit
a9c81643b2
|
@ -1,6 +1,7 @@
|
|||
[gd_resource type="Resource" script_class="Cutscene" load_steps=16 format=3 uid="uid://c8pfjfnwim673"]
|
||||
[gd_resource type="Resource" script_class="Cutscene" load_steps=18 format=3 uid="uid://c8pfjfnwim673"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/wait.gd" id="1_uoty8"]
|
||||
[ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/play_character_animation.gd" id="2_onwwi"]
|
||||
[ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/show_dialogue.gd" id="2_vliur"]
|
||||
[ext_resource type="Script" path="res://Scripts/Cutscenes/Commands/emit_message.gd" id="3_e5ujb"]
|
||||
[ext_resource type="Script" path="res://Scripts/Cutscenes/cutscene.gd" id="3_kh4kq"]
|
||||
|
@ -11,6 +12,11 @@
|
|||
script = ExtResource("1_uoty8")
|
||||
time = 2.01667
|
||||
|
||||
[sub_resource type="Resource" id="Resource_abuy5"]
|
||||
script = ExtResource("2_onwwi")
|
||||
target_character = NodePath("../ReedAI")
|
||||
animation_state = "cut_idle"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_46i1x"]
|
||||
script = ExtResource("2_vliur")
|
||||
character = 1
|
||||
|
@ -72,5 +78,5 @@ time = 2.01667
|
|||
[resource]
|
||||
resource_name = "reed_loses"
|
||||
script = ExtResource("3_kh4kq")
|
||||
commands = Array[Resource("res://Scripts/Cutscenes/Commands/base.gd")]([SubResource("Resource_j0qrl"), SubResource("Resource_46i1x"), SubResource("Resource_w88ia"), SubResource("Resource_dxa8x"), SubResource("Resource_uu88j"), SubResource("Resource_qs5xn"), SubResource("Resource_qkt15"), SubResource("Resource_12o2v"), SubResource("Resource_uw5p1")])
|
||||
commands = Array[Resource("res://Scripts/Cutscenes/Commands/base.gd")]([SubResource("Resource_j0qrl"), SubResource("Resource_abuy5"), SubResource("Resource_46i1x"), SubResource("Resource_w88ia"), SubResource("Resource_dxa8x"), SubResource("Resource_uu88j"), SubResource("Resource_qs5xn"), SubResource("Resource_qkt15"), SubResource("Resource_12o2v"), SubResource("Resource_uw5p1")])
|
||||
auto_start_on_load = true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=71 format=3 uid="uid://bwrwh5of0jw4a"]
|
||||
[gd_scene load_steps=76 format=3 uid="uid://bwrwh5of0jw4a"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/hiro_ai.gd" id="1_yavbv"]
|
||||
[ext_resource type="PackedScene" uid="uid://dexgmkojd8tpt" path="res://Effects/energy_blast.tscn" id="2_xodg4"]
|
||||
|
@ -15,6 +15,29 @@
|
|||
shader = ExtResource("2_y6nd7")
|
||||
shader_parameter/FlashColor = Color(1, 0, 0, 0)
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_oay50"]
|
||||
animation = &"idle_south"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_62pxx"]
|
||||
animation = &"hurt_west"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_66fxj"]
|
||||
animation = &"idle_east"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_d3ndd"]
|
||||
animation = &"idle_north"
|
||||
|
||||
[sub_resource type="AnimationNodeBlendSpace2D" id="AnimationNodeBlendSpace2D_7lb65"]
|
||||
blend_point_0/node = SubResource("AnimationNodeAnimation_oay50")
|
||||
blend_point_0/pos = Vector2(0, 1)
|
||||
blend_point_1/node = SubResource("AnimationNodeAnimation_62pxx")
|
||||
blend_point_1/pos = Vector2(-1, 0)
|
||||
blend_point_2/node = SubResource("AnimationNodeAnimation_66fxj")
|
||||
blend_point_2/pos = Vector2(1, 0)
|
||||
blend_point_3/node = SubResource("AnimationNodeAnimation_d3ndd")
|
||||
blend_point_3/pos = Vector2(0, -1)
|
||||
blend_mode = 1
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_vk5j3"]
|
||||
animation = &"walking_south"
|
||||
|
||||
|
@ -253,6 +276,8 @@ advance_condition = &"range"
|
|||
allow_transition_to_self = true
|
||||
states/End/position = Vector2(1026, 108)
|
||||
states/Start/position = Vector2(197, 108)
|
||||
states/cut_idle/node = SubResource("AnimationNodeBlendSpace2D_7lb65")
|
||||
states/cut_idle/position = Vector2(750, 400)
|
||||
states/cut_walk/node = SubResource("AnimationNodeBlendSpace2D_h2456")
|
||||
states/cut_walk/position = Vector2(563, 400)
|
||||
states/defeated/node = SubResource("AnimationNodeAnimation_kgin3")
|
||||
|
@ -270,7 +295,7 @@ 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"), "range_attack", "idle", SubResource("AnimationNodeStateMachineTransition_ufuqv"), "idle", "range_attack", SubResource("AnimationNodeStateMachineTransition_w4gie")]
|
||||
graph_offset = Vector2(-92, 35)
|
||||
graph_offset = Vector2(215, 263)
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_vm050"]
|
||||
radius = 9.0
|
||||
|
@ -316,6 +341,7 @@ tree_root = SubResource("AnimationNodeStateMachine_b0avg")
|
|||
parameters/conditions/is_moving = false
|
||||
parameters/conditions/melee = false
|
||||
parameters/conditions/range = false
|
||||
parameters/cut_idle/blend_position = Vector2(0.102908, -0.492064)
|
||||
parameters/cut_walk/blend_position = Vector2(0.116751, -1.05556)
|
||||
parameters/hurt/blend_position = Vector2(0, -0.873016)
|
||||
parameters/idle/blend_position = Vector2(-0.183445, 0.227513)
|
||||
|
@ -323,7 +349,7 @@ 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/range_attack/blend_position = Vector2(0.910305, -0.026455)
|
||||
parameters/range_attack/blend_position = Vector2(-0.00894856, 0.94709)
|
||||
parameters/walk/blend_position = Vector2(-0.30916, 0.693122)
|
||||
|
||||
[node name="Hitbox" type="Area2D" parent="."]
|
||||
|
@ -580,6 +606,18 @@ script = ExtResource("7_jc1pg")
|
|||
[node name="Victory" type="Node" parent="StateMachine/Root"]
|
||||
script = ExtResource("7_jc1pg")
|
||||
|
||||
[node name="BlastSpawnerEast" type="Marker2D" parent="."]
|
||||
position = Vector2(19, -14)
|
||||
|
||||
[node name="BlastSpawnerWest" type="Marker2D" parent="."]
|
||||
position = Vector2(-21, -15)
|
||||
|
||||
[node name="BlastSpawnerSouth" type="Marker2D" parent="."]
|
||||
position = Vector2(-2, 15)
|
||||
|
||||
[node name="BlastSpawnerNorth" type="Marker2D" parent="."]
|
||||
position = Vector2(-4, -40)
|
||||
|
||||
[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"]
|
||||
|
|
|
@ -61,7 +61,7 @@ func _on_attackbox_area_entered(area: Area2D):
|
|||
|
||||
func _on_cutscene_issued_command(command: CutsceneCommand, manager: CutsceneManager):
|
||||
if command is MoveCharacterCommand:
|
||||
var target_character = manager.get_node(command.target_character)
|
||||
var target_character = manager.root.get_node(command.target_character)
|
||||
if target_character != self:
|
||||
return
|
||||
movement_scripted_target = command.target_vector if command.target_type == "Vector" else manager.get_node(command.target_node).global_position
|
||||
|
@ -72,6 +72,12 @@ func _on_cutscene_issued_command(command: CutsceneCommand, manager: CutsceneMana
|
|||
movement_scripted_by = manager
|
||||
movement_scripted_speed = move_speed
|
||||
anim_playback.travel(command.animation_state)
|
||||
elif command is PlayCharacterAnimationCommand:
|
||||
var target_character = manager.root.get_node(command.target_character)
|
||||
if target_character != self:
|
||||
return
|
||||
anim_playback.travel(command.animation_state)
|
||||
manager.step()
|
||||
|
||||
|
||||
func _on_interact_box_area_entered(area: Area2D):
|
||||
|
|
6
Scripts/Cutscenes/Commands/play_character_animation.gd
Normal file
6
Scripts/Cutscenes/Commands/play_character_animation.gd
Normal file
|
@ -0,0 +1,6 @@
|
|||
@tool
|
||||
extends CutsceneCommand
|
||||
class_name PlayCharacterAnimationCommand
|
||||
|
||||
@export_node_path("CharacterBase") var target_character: NodePath
|
||||
@export var animation_state: String = ""
|
|
@ -26,6 +26,13 @@ signal range_attack_initiated(by: CharacterBase)
|
|||
@onready var melee_hitbox = $Meleebox
|
||||
@onready var melee_hitbox_collider = $Meleebox/DetectionArea
|
||||
|
||||
@onready var spawners = {
|
||||
Vector2(1,0): $BlastSpawnerEast,
|
||||
Vector2(-1,0): $BlastSpawnerWest,
|
||||
Vector2(0,1): $BlastSpawnerSouth,
|
||||
Vector2(0,-1): $BlastSpawnerNorth
|
||||
}
|
||||
|
||||
var timer = 0
|
||||
|
||||
# Getting hurt variables
|
||||
|
@ -48,6 +55,7 @@ func set_animation_direction(facing_direction: Vector2):
|
|||
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_idle/blend_position", facing_direction)
|
||||
anim_tree.set("parameters/cut_walk/blend_position", facing_direction)
|
||||
|
||||
func follow_player(speed: float):
|
||||
|
@ -84,9 +92,10 @@ func align_with_player(speed: float):
|
|||
|
||||
func spawn_projectile(direction: Vector2):
|
||||
var instance = projectile.instantiate()
|
||||
instance.direction = anim_tree.get("parameters/range_attack/blend_position")
|
||||
instance.direction = direction
|
||||
var spawner = spawners[direction]
|
||||
instance.speed = PROJECTILE_SPEED
|
||||
instance.position = global_position + instance.direction * 30.0
|
||||
instance.position = spawner.global_position
|
||||
instance.power = PROJECTILE_POWER
|
||||
get_parent().add_child(instance)
|
||||
instance.collided_with_area.connect(player_character._on_enemy_attack_did_hit)
|
||||
|
|
Loading…
Reference in a new issue