diff options
Diffstat (limited to 'level.js')
-rw-r--r-- | level.js | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -174,9 +174,12 @@ function stepLevel(ui, level, index) { finishLevel(ui, level, false); render(ui.ctx, level, 0); } else if (level.running && index < level.path.length-1) { - setTimeout(() => stepLevel(ui, level, index+1), 1); + const distNext = distance(pos, level.path[index+1] || pos); + setTimeout(() => stepLevel(ui, level, index+1), 50*distNext); } else { - finishLevel(ui, level, true); + if (index >= level.path.length-1) { + finishLevel(ui, level, true); + } level.running = false; render(ui.ctx, level, 0); } |