function movePlayer(e) {
    if (gameStarted == true) {
        console.log(curY);
        if (curY > 900 && curY < 955) {
            document.body.style.overflow = "visible";
        }
        else {
            document.body.style.overflow = "hidden";
        }
        switch (e.keyCode) {
            case 37:
                curX -= 5;
                console.log("Venstre");
                break;
            case 38:
                console.log("Opp");
                curY -= 5;
                break;
            case 39:
                console.log("Høgre");
                curX += 5;
                break;
            case 40:
                console.log("Ned");
                curY += 5;
                break;
        }
    }
}
/**
 * Checks if arrow-keys are pressed, then moves character accordingly.
 */
Checks if arrow-keys are pressed, then moves character accordingly.
Checks if arrow - keys are pressed then moves character accordingly .
function movePlayer(e) {
    if (gameStarted == true) {
        console.log(curY);
        if (curY > 900 && curY < 955) {
            document.body.style.overflow = "visible";
        }
        else {
            document.body.style.overflow = "hidden";
        }
        switch (e.keyCode) {
            case 37:
                curX -= 5;
                console.log("Venstre");
                break;
            case 38:
                console.log("Opp");
                curY -= 5;
                break;
            case 39:
                console.log("Høgre");
                curX += 5;
                break;
            case 40:
                console.log("Ned");
                curY += 5;
                break;
        }
    }
}
function movePlayer ( e ) { if ( gameStarted == true ) { console . log ( curY ) ; if ( curY > 900 && curY < 955 ) { document . body . style . overflow = "visible" ; } else { document . body . style . overflow = "hidden" ; } switch ( e . keyCode ) { case 37 : curX -= 5 ; console . log ( "Venstre" ) ; break ; case 38 : console . log ( "Opp" ) ; curY -= 5 ; break ; case 39 : console . log ( "Høgre") ; curX += 5 ; break ; case 40 : console . log ( "Ned" ) ; curY += 5 ; break ; } } }
Checks if arrow-keys are pressed, then moves character accordingly.
Checks if arrow - keys are pressed then moves character accordingly .