Files
Scoom/scripts/player/Hitable.gd

22 lines
385 B
GDScript

extends Node
class_name Hitable
var health = 200
var enemies_in_range = []
func Hit(dmg):
#var tween = create_tween()
health -= dmg
if(health <= 0):
queue_free()
func _on_area_3d_body_entered(body):
if body.get_collision_layer() == 10:
enemies_in_range.append(body)
func _on_area_3d_body_exited(body):
if body.get_collision_layer() == 10:
enemies_in_range.erase(body)