From c5b94b59c5c699fe920f202435afb276eed31b46 Mon Sep 17 00:00:00 2001 From: Nathan DECHER Date: Thu, 26 Mar 2020 20:12:19 +0100 Subject: [PATCH] animations are no longer all in sync --- src/js/snek.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/snek.js b/src/js/snek.js index 789663a..a33c160 100644 --- a/src/js/snek.js +++ b/src/js/snek.js @@ -134,6 +134,9 @@ class SnekGame { cellSize, cellSize ); + const putTileAnim=(x, y, tile) => putTile(x, y, tile[ + Math.floor(Date.now()/1000*60+x+y)%tile.length + ]); const checkAdj=(x, y) => { let adj={}; adj.u=this.world[x][y-1]; @@ -154,7 +157,7 @@ class SnekGame { break; case FIRE: - putTile(x, y, fire[Math.floor(Date.now()/1000*60)%60]); + putTileAnim(x, y, fire); break; case HOLE: