Files
hsgj25-growth/growth/CardInjects/Katana/katana.gd
2025-10-05 13:34:48 +02:00

18 lines
628 B
GDScript

extends Node2D
@export var damage = 5
@export var knockback_strength = 3
func _on_area_entered(area: Area2D) -> void:
if self.get_parent().is_in_group("Virus"):
# Prevent friendly fire
return
var area_parent = area.get_parent()
if (area_parent.is_in_group("Virus")):
area_parent.take_hit(damage, self.position.direction_to(area.position) * 200, knockback_strength)
func _on_body_entered(body):
if self.get_parent() == body:
return
print_debug("Cursor bullet hit %s" % body.name)
body.take_hit(damage, self.position.direction_to(body.position) * 200, knockback_strength)