Judging from your code-snippet, you can walk diagonally too, but you only assigned 4 directions to your spriteloop.
You either add additional conditions for diagonal movement or you completely switch to 4 direction movement.
Conditions for diagonal movement would be (keep everything as is, but add 4 extra conditions to your spriteloop):
if dir.right and dir.up:
sprite_dir = "up" # or right, depends on your preference
if dir.right and dir.down:
sprite_dir = "down" # or right, again your preference what you like more
Or you switch to 4 way movement instead of 8 with the following code example (just switch out input code, keep everything else as is):
velocity = Vector2()
velocity.x += 1
velocity.x -= 1
velocity.y += 1
velocity.y -= 1
movement = velocity.normalized() * speed
and have your process set up like
The second version is what I have switched to in my game. It fits more to the retro arcade style I try to follow, where you only could walk in 4 directions.
Would be nice if you could report back if this helped.