first commit
This commit is contained in:
22
demo/agents/scripts/hurtbox.gd
Normal file
22
demo/agents/scripts/hurtbox.gd
Normal file
@@ -0,0 +1,22 @@
|
||||
#*
|
||||
#* hurtbox.gd
|
||||
#* =============================================================================
|
||||
#* Copyright (c) 2023-present Serhii Snitsaruk and the LimboAI contributors.
|
||||
#*
|
||||
#* Use of this source code is governed by an MIT-style
|
||||
#* license that can be found in the LICENSE file or at
|
||||
#* https://opensource.org/licenses/MIT.
|
||||
#* =============================================================================
|
||||
#*
|
||||
class_name Hurtbox
|
||||
extends Area2D
|
||||
## Area that registers damage.
|
||||
|
||||
@export var health: Health
|
||||
|
||||
var last_attack_vector: Vector2
|
||||
|
||||
|
||||
func take_damage(amount: float, knockback: Vector2, source: Hitbox) -> void:
|
||||
last_attack_vector = owner.global_position - source.owner.global_position
|
||||
health.take_damage(amount, knockback)
|
||||
Reference in New Issue
Block a user