Death anim added.

This commit is contained in:
Nitsud Yarg 2024-06-21 22:02:16 -07:00
parent fb5f0dd872
commit 3f47fbbf7c
5 changed files with 16 additions and 8 deletions

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=11 format=2] [gd_scene load_steps=11 format=2]
[ext_resource path="res://src/Levels/Level3.tscn" type="PackedScene" id=1] [ext_resource path="res://src/Levels/Level.tscn" type="PackedScene" id=1]
[ext_resource path="res://src/CameraControl-Position2D.gd" type="Script" id=5] [ext_resource path="res://src/CameraControl-Position2D.gd" type="Script" id=5]
[ext_resource path="res://assets/Fonts/QuinqueFive.tres" type="DynamicFont" id=8] [ext_resource path="res://assets/Fonts/QuinqueFive.tres" type="DynamicFont" id=8]
[ext_resource path="res://src/UI_Layer.gd" type="Script" id=9] [ext_resource path="res://src/UI_Layer.gd" type="Script" id=9]
@ -16,7 +16,7 @@ b = Vector2( -1, 349 )
[node name="Main" type="Node2D"] [node name="Main" type="Node2D"]
[node name="Level3" parent="." instance=ExtResource( 1 )] [node name="Level" parent="." instance=ExtResource( 1 )]
[node name="Player" parent="." instance=ExtResource( 14 )] [node name="Player" parent="." instance=ExtResource( 14 )]
position = Vector2( 93, 54 ) position = Vector2( 93, 54 )

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 119 KiB

View File

@ -33,7 +33,10 @@ func _on_attack_do_attack():
func _on_Health_Component_health_depleted(): func _on_Health_Component_health_depleted():
queue_free() $Hurtbox_Component.set_hurtbox(false)
movement_state_machine.change_state($movement_state_machine/die)
yield( get_tree().create_timer(10), "timeout")
#queue_free()
func _on_roll_frame_reached(state_name, animation_name, frame_number): func _on_roll_frame_reached(state_name, animation_name, frame_number):
print("I'm invincible!!!") print("I'm invincible!!!")
@ -43,4 +46,5 @@ func _on_roll_state_exited():
print("Nevermind. I'm vulnerable.") print("Nevermind. I'm vulnerable.")
$Hurtbox_Component.set_hurtbox(true) $Hurtbox_Component.set_hurtbox(true)
func _on_die_state_entered():
pass # Replace with function body.

View File

@ -551,7 +551,7 @@ __meta__ = {
"o_folder": "res://assets", "o_folder": "res://assets",
"o_name": "", "o_name": "",
"only_visible": true, "only_visible": true,
"op_exp": true, "op_exp": false,
"slice": "", "slice": "",
"source": "D:/Sync/Assets/Library/Mega.ase" "source": "D:/Sync/Assets/Library/Mega.ase"
} }
@ -649,6 +649,7 @@ idle_node = NodePath("../idle")
[node name="die" type="Node" parent="movement_state_machine" index="8"] [node name="die" type="Node" parent="movement_state_machine" index="8"]
script = ExtResource( 15 ) script = ExtResource( 15 )
animation_sequence = [ "die" ]
[node name="Hurtbox_Component" parent="." index="4"] [node name="Hurtbox_Component" parent="." index="4"]
collision_layer = 16 collision_layer = 16
@ -680,4 +681,5 @@ default_color = Color( 1, 0.607843, 0, 1 )
[connection signal="do_attack" from="movement_state_machine/attack" to="." method="_on_attack_do_attack"] [connection signal="do_attack" from="movement_state_machine/attack" to="." method="_on_attack_do_attack"]
[connection signal="frame_reached" from="movement_state_machine/roll" to="." method="_on_roll_frame_reached"] [connection signal="frame_reached" from="movement_state_machine/roll" to="." method="_on_roll_frame_reached"]
[connection signal="state_exited" from="movement_state_machine/roll" to="." method="_on_roll_state_exited"] [connection signal="state_exited" from="movement_state_machine/roll" to="." method="_on_roll_state_exited"]
[connection signal="state_entered" from="movement_state_machine/die" to="." method="_on_die_state_entered"]
[connection signal="health_depleted" from="Health_Component" to="." method="_on_Health_Component_health_depleted"] [connection signal="health_depleted" from="Health_Component" to="." method="_on_Health_Component_health_depleted"]

View File

@ -4,9 +4,10 @@ export (NodePath) var idle_node
onready var idle_state: State = get_node(idle_node) onready var idle_state: State = get_node(idle_node)
var flash_color = Color.red var flash_color = Color.yellow
func enter() -> void: func enter() -> void:
modifier_stack_ref.clear()
.enter() .enter()
move_component.velocity.x = 0 move_component.velocity.x = 0
#parent.set_hurtbox(false) #parent.set_hurtbox(false)
@ -25,8 +26,9 @@ func process_input(_event: InputEvent) -> State:
func process_frame(delta: float) -> State: func process_frame(delta: float) -> State:
#flash_color.linear_interpolate(Color.white, abs(sin(state_timeout.time_left)))
UiManager.debug_text = str(abs(sin((ceil(state_timeout.time_left) - state_timeout.time_left)/.5))) # Apply a little effect when damage taken.
#UiManager.debug_text = str(abs(sin((ceil(state_timeout.time_left) - state_timeout.time_left)/.5)))
animations.modulate = flash_color.linear_interpolate(Color.white, abs(sin((ceil(state_timeout.time_left) - state_timeout.time_left)/.5))) animations.modulate = flash_color.linear_interpolate(Color.white, abs(sin((ceil(state_timeout.time_left) - state_timeout.time_left)/.5)))
if state_timeout.time_left == 0: if state_timeout.time_left == 0: