Making movements help

hey

var speeds = speed;
    if(Keyboard.keyPressed(Keyboard.SHIFT))
    {
        speeds += sprint;
    }

    //Move player using WASD
    if(Keyboard.keyPressed(Keyboard.W))
    {
        player.velocity.x = speeds * Math.sin(camera.mouseRotation.x);
        player.velocity.z = speed * Math.cos(camera.mouseRotation.x);
    }
    if(Keyboard.keyPressed(Keyboard.S))
    {
        player.velocity.x = -speeds * Math.sin(camera.mouseRotation.x);
        player.velocity.z = -speeds * Math.cos(camera.mouseRotation.x);
    }
    if(Keyboard.keyPressed(Keyboard.A))
    {
        player.velocity.x = speeds * Math.sin(camera.mouseRotation.x + MathUtils.PID2);
        player.velocity.z = speeds * Math.cos(camera.mouseRotation.x + MathUtils.PID2);
    }
    if(Keyboard.keyPressed(Keyboard.D))
    {
        player.velocity.x = -speeds * Math.sin(camera.mouseRotation.x + MathUtils.PID2);
        player.velocity.z = -speeds * Math.cos(camera.mouseRotation.x + MathUtils.PID2);
    }

ok so this is the movement scripts… but i cant move left and foward at the same time
do u know how i can make this better?

In a similar case I solved this by combining functions.

function noCommand(obj) {}
function turnRight( obj ) { obj.rotateY( -speedTurn * velocity ); }
function lookUp( obj ) { if ( obj.rotation.x < 1.45 ) obj.rotation.x += speedLookHighDeep * velocity; }
function turnLeft( obj ) { obj.rotateY( speedTurn * velocity ); }
function lookDown( obj ) { if ( obj.rotation.x > -1.45 ) obj.rotation.x += -speedLookHighDeep * velocity; }
function moveRight( obj ) {	obj.translateX( speedLeftRight * velocity * sf ); }
function moveForward( obj ) { obj.translateZ( -speedVorward * velocity * sf ); }
function moveLeft( obj ) { obj.translateX( -speedLeftRight * velocity * sf ); }
function moveBack( obj ) { obj.translateZ( speedBackward * velocity * sf ); }
function moveRightForward( obj ){ 0.7 * moveRight( obj ); 0.7 * moveForward( obj ) }
function moveLeftForward( obj ){ 0.7 * moveLeft( obj ); 0.7 * moveForward( obj ) }
function moveLeftBack( obj ){ 0.7 * moveLeft( obj ); 0.7 * moveBack( obj ) }  
function moveRightBack( obj ){ 0.7 * moveRight( obj ); 0.7 * moveBack( obj ) }