extends Area2D export var speed = 100 var velocity = Vector2() var rot = Vector2() var time = 0 export var amplitude = 4 export var frequency = 5 var gravitile = 5 func follow_line_trajectory(): velocity = Vector2(1, 0) #Vector2(cos(self.global_rotation), sin(self.global_rotation)) return velocity func follow_sine_trajectory(): velocity.y = amplitude * cos(time * frequency) velocity.x = 5 return velocity func follow_parabolic_trajectory(): velocity.x = 5 velocity.y = 1 * time * gravitile return velocity func follow_hyperbolic_trajectory(): velocity.x = gravitile * time velocity.y = 1 return velocity func input(): if Input.is_action_just_pressed("line"): return follow_sine_trajectory() elif Input.is_action_just_pressed("sine"): return follow_line_trajectory() else: print('Trajectory is not selected') queue_free() func _process(delta): time += delta position += velocity * speed * delta func _on_Bullet_body_entered(body): if body.is_in_group("mobs"): body.queue_free() queue_free()