The problem is that you set it up in a if/if else conditional, but it should be only if conditionals. Like
if(leftKey){
...
}
if(rightKey){
..
}
if(upKey){
...
}
because think about it, in your code you first check if the upKey is pressed, if this evaluates to true it will execute that part and skip all the rest because all the other if conditionals can only be executed if upKey is false.