From 83c856d2776d70948411b21785f6e7ef33180db3 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Tue, 29 May 2018 02:51:40 -0400 Subject: [PATCH] Fixed that lasers don't queue_free offscreen --- Laser.gd | 3 +++ Laser.tscn | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Laser.gd b/Laser.gd index 1f37e17..ce3e1f9 100644 --- a/Laser.gd +++ b/Laser.gd @@ -53,6 +53,9 @@ func _process(delta): velocity.x -= 1 velocity = velocity.normalized() * SPEED position += velocity * delta + + if position.x > 2000: + queue_free() func _on_Laser_body_entered(body): emit_signal("hit") diff --git a/Laser.tscn b/Laser.tscn index 9c824c2..a48c832 100644 --- a/Laser.tscn +++ b/Laser.tscn @@ -19,7 +19,7 @@ animations = [ { "speed": 20.0 } ] -[node name="Laser" type="Area2D"] +[node name="Laser" type="Area2D" index="0"] input_pickable = true gravity_vec = Vector2( 0, 1 )