diff --git a/game.js b/game.js index dff5363..6c670ac 100644 --- a/game.js +++ b/game.js @@ -142,6 +142,9 @@ function stop_timing() { function restart_game() { game_finished = false; mines_placed = false; + // Based on the level, we calculate the grid size and amount + // of mines. The height of the grid increases every two + // levels. field_height = 8 + Math.floor(current_level / 2); minefield_initialize(); update_particle_canvas_size(); @@ -157,11 +160,6 @@ function restart_game() { } function start_or_continue_game(level) { - // Based on the level, we calculate the grid size and amount - // of mines. The height of the grid increases every two - // levels. - current_level = level; - field_height = 8 + Math.floor(current_level / 2); let minefield_html = localStorage.getItem(current_level + "-minefield_html"); $("#level").innerText = current_level; if (minefield_html == null) { @@ -346,4 +344,4 @@ function lose_game() { cell.innerText = ""; } }); -} \ No newline at end of file +}