If you put this after your move_ and_ slide the script will work nicely:
pos = pos.linear_interpolate(Vector2(0,0), friction * delta)
Funny, huh? The pos variable is doing what your velocity is supposed to do. Here's a corrected script:
extends KinematicBody2D
export (int) var speed = 500
export (float) var rotation_speed = 1.5
export (float) var friction = 0.65
var velocity = Vector2()
var rotation_dir = 0
var acc = Vector2()
func _ready():
pass
func _physics_process(delta):
rotation_dir = 0
if Input.is_action_pressed('right'):
rotation_dir += 1
if Input.is_action_pressed('left'):
rotation_dir -= 1
if Input.is_action_pressed('up'):
acc = Vector2(0, -speed).rotated(rotation)
elif Input.is_action_pressed('down'):
acc = Vector2(0, speed).rotated(rotation)
else:
acc = Vector2(0, 0)
velocity += acc * delta
rotation += rotation_dir * rotation_speed * delta
move_and_slide(velocity, Vector2(0, 0))
velocity = velocity.linear_interpolate(Vector2(0,0), friction * delta)
I removed the pos variable since it's not needed, and I removed the part where you set velocity to zero, and I added the last line that does the friction part.