Fixed that lasers don't queue_free offscreen

This commit is contained in:
Sage Vaillancourt 2018-05-29 02:51:40 -04:00
parent eddcd6d388
commit 83c856d277
2 changed files with 4 additions and 1 deletions

View File

@ -54,6 +54,9 @@ func _process(delta):
velocity = velocity.normalized() * SPEED velocity = velocity.normalized() * SPEED
position += velocity * delta position += velocity * delta
if position.x > 2000:
queue_free()
func _on_Laser_body_entered(body): func _on_Laser_body_entered(body):
emit_signal("hit") emit_signal("hit")
if plasma == false: if plasma == false:

View File

@ -19,7 +19,7 @@ animations = [ {
"speed": 20.0 "speed": 20.0
} ] } ]
[node name="Laser" type="Area2D"] [node name="Laser" type="Area2D" index="0"]
input_pickable = true input_pickable = true
gravity_vec = Vector2( 0, 1 ) gravity_vec = Vector2( 0, 1 )