``````extends KinematicBody2D
``````

var movespeed : int = 80

var interactDist : int = 70

var vel : Vector2 = Vector2()
var facingDir : Vector2 = Vector2()

func physicsprocess(delta):

``````vel = Vector2()

#inputs
if Input .is_action_pressed("KeyUp"):
vel.y -=1
facingDir = Vector2(0, -1)
animationPlayer.play("RunUp")
if Input .is_action_pressed("KeyDown"):
vel.y +=1
facingDir = Vector2(0, 1)
animationPlayer.play("RunDown")
if Input .is_action_pressed("KeyLeft"):
vel.x -=1
facingDir = Vector2(-1, 0)
animationPlayer.play("RunLeft")
if Input .is_action_pressed("KeyRight"):
vel.x +=1
facingDir = Vector2(1, 0)
animationPlayer.play("RunRight")

if Input .is_action_just_released("KeyRight"):
vel.x +=1
facingDir = Vector2(1, 0)
animationPlayer.play("IdleRight")

if Input .is_action_just_released("KeyLeft"):
vel.x -=1
facingDir = Vector2(-1, 0)
animationPlayer.play("IdleLeft")

if Input .is_action_just_released("KeyUp"):
vel.y -=1
facingDir = Vector2(0, -1)
animationPlayer.play("IdleUp")

if Input .is_action_just_released("KeyDown"):
vel.y +=1
facingDir = Vector2(0, 1)
animationPlayer.play("IdleDown")

# normalized the velocity to prevent faster diagonal movement

vel = vel.normalized()

# move the player
move_and_slide(vel * movespeed)
``````

in Engine

uh, what happens. there's nothing on the question that tells us the problem, were you trying to post a gif? Also, if you could put four spaces in front of all your code lines, they would be put in a code box and be much more readable. :)