feat: tatoebaspil m kiva hammasbaksu au andrjoku
This commit is contained in:
parent
b2d5ab61d2
commit
050e8f9e22
104 changed files with 3017 additions and 27 deletions
16
scripts/Characters/Enemy/attack_box.gd
Normal file
16
scripts/Characters/Enemy/attack_box.gd
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
extends Area2D
|
||||
|
||||
@onready var character = get_parent()
|
||||
var damage = 1
|
||||
|
||||
func _on_area_entered(target: Area2D) -> void:
|
||||
|
||||
# Damage target area if it has _take_damage method
|
||||
if target.has_method("_take_damage"):
|
||||
target._take_damage(damage)
|
||||
character._take_damage()
|
||||
|
||||
# Damage target area parent if it has _take_damage method
|
||||
if target.get_parent().has_method("_take_damage"):
|
||||
target.get_parent()._take_damage(damage)
|
||||
character._take_damage()
|
||||
Loading…
Add table
Add a link
Reference in a new issue