Diagonal movement is possible. If two non-conflicting keys are pressed, then the character walks both those ways
I meant, you can't check collisions in both directions if you're moving diagonal. You have a variable "dir" which can only be set to left, right, up or down, so, if you're moving up and right, you can only check the collision with either up or right, not both. that needs ot be fixed. The easier way is to remove the dir variable all together, and just use your X and Y speed to determine which way your character is moving, so, if X is positive it's moving right, and if Y is positive, it's moving down as well.
Also, you need to remove the "moved" variable: If you collide with something, you are setting the moved variable to true, and that stops all other collision corrections. This is what actually sounds like your problem, combined with the dir variable.