Hi
I'm not sure if Godot has a built-in function for this or not, but I've tried to make something like the "lengthdir" function from GameMaker and although it works, it doesn't look as smooth and has some issues.
https://i.imgur.com/xRPUsqg.gif
As you can see, when I'm shooting in a straight line, it's fine, but as soon as I rotate the character (while shooting), it does a weird animation.
func shoot():
if can_shoot:
can_shoot = false
var dir = Vector2(1, 0).rotated($Sprite/shootspot.global_rotation)
var kick = 200
var kickdirection = (rad2deg(dir.angle())) - 180
velocity.x = velocity.x + (kick * cos(kickdirection))
velocity.y = velocity.y + (kick * -sin(kickdirection))