move_to()
will instantly move the KinematicBody2D to that position. What you want to do is make a script for the bullet that will move it every frame in the _fixed_process()
function.
Here's a quick example:
extends KinematicBody2D
var SPEED = 100
var shoot_dir = Vector2()
func fire(position, direction):
shoot_dir = direction.normalized()
set_pos(position)
set_fixed_process(true)
func _fixed_process(delta):
move(shoot_dir * SPEED * delta)
# Can do other things if nessicary, like checking if the bullet is_colliding()
Calling the fire()
function will fire the bullet from position in the direction you pass it.
var bullet = bullet_scene.instance()
add_child(bullet)
bullet.fire(gun.get_pos(), Vector2(1, 0))
So you'd do something like that when spawning the bullet.