From e9598b88841374301646a7115253ab38ac904e4c Mon Sep 17 00:00:00 2001 From: jacopograndi Date: Fri, 24 Dec 2021 21:10:33 +0100 Subject: working --- scripts/bullet.gd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts/bullet.gd') diff --git a/scripts/bullet.gd b/scripts/bullet.gd index 9b4434d..994d3d1 100644 --- a/scripts/bullet.gd +++ b/scripts/bullet.gd @@ -3,6 +3,8 @@ extends Spatial var _enemies_holder var shooter +var damage = 1 + var timer = 0 var time_life = 3 var speed = 7 @@ -10,7 +12,7 @@ var hit_something = false func _ready(): _enemies_holder = get_tree().root.get_child(0).find_node("enemies") - $Area.connect("body_entered", self, "collided") + var _err = $Area.connect("body_entered", self, "collided") func _physics_process(delta): var forward_dir = -global_transform.basis.z.normalized() @@ -27,7 +29,7 @@ func collided(body): if hit_something == false: var groups = parent.get_groups() if "enemies" in groups: - _enemies_holder.damage(parent.name) + _enemies_holder.damage(parent.name, damage) hit_something = true queue_free() -- cgit v1.2.3-54-g00ecf