From 7f8efaa4e0ea1a256d883dbbaffa4894b3c73b6f Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Sun, 4 Oct 2020 09:40:52 -0600 Subject: [PATCH] Fix flicker when moving in sync with a N/W actor at the edge of the viewport --- js/renderer-canvas.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/renderer-canvas.js b/js/renderer-canvas.js index 441b2b3..edbbe3a 100644 --- a/js/renderer-canvas.js +++ b/js/renderer-canvas.js @@ -111,12 +111,12 @@ export class CanvasRenderer { // The viewport might not be aligned to the grid, so split off any fractional part. let xf0 = Math.floor(x0); let yf0 = Math.floor(y0); - // Note that when the viewport is exactly aligned to the grid, we need to draw the cells - // just outside of it, or we'll miss objects partway through crossing the border - if (xf0 === x0 && xf0 > 0) { + // We need to draw one cell beyond the viewport, or we'll miss objects partway through + // crossing the border moving away from us + if (xf0 > 0) { xf0 -= 1; } - if (yf0 === y0 && yf0 > 0) { + if (yf0 > 0) { yf0 -= 1; } // Find where to stop drawing. As with above, if we're aligned to the grid, we need to