Very likely the errors with this long time on js wrote.
$(document).ready(function() { var Game = { isGameStarted: false, start: function(event) { // this method needs a lock, but it'll do for now. if (true == this.isGameStarted) { return; } if ($('.user_name').val() == ") { $('.errors').html('Enter the name!'); return; } this.isGameStarted = true; $('.start_game_box').addClass('hidden'); $('.user').removeClass('hidden'); $(document).keydown(this.goUser); }, goUser: function(event) { if (false == this.isGameStarted) { return; } var pz_user = $('.user').offset(), top = pz_user['top'], left = pz_user['left']; if (event.which === 38) { var top = top -5; $('.user').css('top', top + 'px') } if (event.which === 40) { var top = top +5; $('.user').css('top', top + 'px') } if (event.which === 37) { var left = left -5; $('.user').css('left', left + 'px') } if (event.which === 39) { var left = left +5; $('.user').css('left', left + 'px') } } }; $('.btn_start').on('click', Game.start); });