Attempt2/src/actors/players/playerE/PlayerE.gd
2025-03-25 15:27:18 -07:00

27 lines
776 B
GDScript3

extends Actor
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
PlayerInfo.player_health = $Health_Component.health
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func hit_Receiver(damage):
$Hurtbox_Component.set_hurtbox(false)
$Health_Component.take_damage(damage)
if $Health_Component.health > 0:
movement_state_machine.change_to_known_state('hurt')
PlayerInfo.player_health = $Health_Component.health
if PlayerInfo.player_health <= 0:
return
yield( get_tree().create_timer(2 + movement_state_machine.get_state_reference('hurt').timeout_seconds), "timeout")
$Hurtbox_Component.set_hurtbox(true)