refactored js/game.js and improved js/entities.js and js/input.js