aboutsummaryrefslogtreecommitdiff
path: root/scripts/bullet.gd
diff options
context:
space:
mode:
authorjacopograndi <jacopo.grandi@outlook.it>2021-12-24 21:10:33 +0100
committerjacopograndi <jacopo.grandi@outlook.it>2021-12-24 21:10:33 +0100
commite9598b88841374301646a7115253ab38ac904e4c (patch)
tree0ddc46c3ebd34762408cb108a3dbfb98d669af85 /scripts/bullet.gd
parent156420f2a4635a84390e8ff488d12b8f84fea94f (diff)
working
Diffstat (limited to 'scripts/bullet.gd')
-rw-r--r--scripts/bullet.gd6
1 files changed, 4 insertions, 2 deletions
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()