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

@ -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")

View File

@ -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 )