aboutsummaryrefslogtreecommitdiffstats
path: root/Bullet.gd
diff options
context:
space:
mode:
authorLogan B <113468801+LoganLDB@users.noreply.github.com>2022-10-29 22:07:20 +0100
committerLogan B <113468801+LoganLDB@users.noreply.github.com>2022-10-29 22:07:20 +0100
commit50b7eb11fe309582002d2fb70742d1c1e6d03d92 (patch)
tree620567e5f0b3c80c28f6bc2b4e2e7ba260699e23 /Bullet.gd
parentb40da120e30d4521736c99392c08e97de2da34ae (diff)
parent553e6d8a818a33195dbf1d01cb517e46fac7996e (diff)
Merge branch 'master' of https://github.com/LMBishop/bazzagazza
Diffstat (limited to 'Bullet.gd')
-rw-r--r--Bullet.gd5
1 files changed, 5 insertions, 0 deletions
diff --git a/Bullet.gd b/Bullet.gd
index 9e64b08..3d850a1 100644
--- a/Bullet.gd
+++ b/Bullet.gd
@@ -5,7 +5,10 @@ var velocity = Vector2()
var target = Vector2.ZERO
#var player = load("")
var shot = false;
+var screen_size
+func _ready():
+ screen_size = get_viewport_rect().size
func _physics_process(delta):
target = get_global_mouse_position()
@@ -19,6 +22,8 @@ func _physics_process(delta):
collision.collider.free()
if velocity == Vector2(0.0, 0.0):
queue_free()
+ if position.x > screen_size.x or position.x < 0 or position.y > screen_size.y or position.y < 0:
+ queue_free()