aboutsummaryrefslogtreecommitdiffstats
path: root/Bullet.gd
diff options
context:
space:
mode:
authorfreddie-a <57713959+freddie-a@users.noreply.github.com>2022-10-29 22:45:55 +0100
committerfreddie-a <57713959+freddie-a@users.noreply.github.com>2022-10-29 22:45:55 +0100
commit136c6918c7d9f3ebe12c4535c438a2c67f01c110 (patch)
tree66360dea71d9c02b2d2f8d864e6ee0448c7b6e0a /Bullet.gd
parenta4ac6fe79a37824f3f720f4a3c468172461f70d7 (diff)
Add bullet collisions
Diffstat (limited to 'Bullet.gd')
-rw-r--r--Bullet.gd7
1 files changed, 6 insertions, 1 deletions
diff --git a/Bullet.gd b/Bullet.gd
index b2058ba..9e64b08 100644
--- a/Bullet.gd
+++ b/Bullet.gd
@@ -13,7 +13,12 @@ func _physics_process(delta):
velocity = global_position.direction_to(target) * speed
shot = true
velocity = move_and_slide(velocity)
-
+ for i in get_slide_count():
+ var collision = get_slide_collision(i)
+ if collision.collider:
+ collision.collider.free()
+ if velocity == Vector2(0.0, 0.0):
+ queue_free()