24 lines
651 B
GDScript
24 lines
651 B
GDScript
extends Actor
|
|
|
|
export var player_number: int = 1
|
|
|
|
onready var player_hurtbox = $Hurtbox_Component/CollisionShape2D
|
|
|
|
|
|
func _ready() -> void:
|
|
movement_component.player_number = player_number
|
|
|
|
|
|
func hit_Receiver(damage):
|
|
$Hurtbox_Component.set_hurtbox(false)
|
|
$Health_Component.take_damage(damage)
|
|
if $Health_Component.health > 0:
|
|
movement_state_machine.change_state($movement_state_machine/hurt)
|
|
PlayerInfo.player_health = $Health_Component.health
|
|
yield( get_tree().create_timer(2 + $movement_state_machine/hurt.timeout_seconds), "timeout")
|
|
$Hurtbox_Component.set_hurtbox(true)
|
|
|
|
|
|
func _on_attack_do_attack():
|
|
pass # Replace with function body.
|