22 lines
435 B
GDScript
22 lines
435 B
GDScript
extends Area2D
|
|
|
|
const SPEED: int = 60
|
|
|
|
var velocity: Vector2 = Vector2.ZERO
|
|
|
|
|
|
func init(spawn_position: Vector2, shoot_position: Vector2) -> void:
|
|
position = spawn_position
|
|
velocity = position.direction_to(shoot_position).normalized() * SPEED
|
|
return
|
|
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
position += velocity * delta
|
|
return
|
|
|
|
|
|
func _on_lifetime_timeout() -> void:
|
|
call_deferred('queue_free')
|
|
return
|