19 - A Star Is Born/script.js
//Event listeners for the arrow keys

Event listeners for the arrow keys
Event listeners for the arrow keys
function userInput(){
    canvas.addEventListener('keydown', function(e){
        if(e.keyCode === 37){
            LEFT = true;
        }
        if(e.keyCode === 38){
            UP = true;
        }
        if(e.keyCode === 39){
            RIGHT = true;
        }
        if(e.keyCode === 40){
            DOWN = true;
        }
    });
    canvas.addEventListener('keyup', function(e){
        if(e.keyCode === 37){
            LEFT = false;
        }
        if(e.keyCode === 38){
            UP = false;
        }
        if(e.keyCode === 39){
            RIGHT = false;
        }
        if(e.keyCode === 40){
            DOWN = false;
        }
    });    
}
function userInput ( ) { canvas . addEventListener ( 'keydown' , function ( e ) { if ( e . keyCode === 37 ) { LEFT = true ; } if ( e . keyCode === 38 ) { UP = true ; } if ( e . keyCode === 39 ) { RIGHT = true ; } if ( e . keyCode === 40 ) { DOWN = true ; } } ) ; canvas . addEventListener ( 'keyup' , function ( e ) { if ( e . keyCode === 37 ) { LEFT = false ; } if ( e . keyCode === 38 ) { UP = false ; } if ( e . keyCode === 39 ) { RIGHT = false ; } if ( e . keyCode === 40 ) { DOWN = false ; } } ) ; }
Event listeners for the arrow keys
Event listeners for the arrow keys