27 lines
583 B
GDScript
27 lines
583 B
GDScript
extends Particles2D
|
|
|
|
export var direction = Vector2.LEFT
|
|
export var speed = 300
|
|
|
|
func _ready() -> void:
|
|
$AnimationPlayer.play("lights_on")
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
if emitting:
|
|
position = position + (direction * speed * delta)
|
|
|
|
|
|
|
|
|
|
func _on_Area2D_body_entered(body: Node) -> void:
|
|
call_deferred("_disable_area")
|
|
emitting = false
|
|
$AnimationPlayer.play("lights_out")
|
|
yield($AnimationPlayer, "animation_finished")
|
|
queue_free()
|
|
pass # Replace with function body.
|
|
|
|
func _disable_area():
|
|
print("beam area off")
|
|
$Area2D/CollisionShape2D.disabled = true
|