javascript of the game with HTML5 Canvas and sprite