From 1113f5f8eb6663f4412942ebe538ef7d5ed026b9 Mon Sep 17 00:00:00 2001 From: Kyle <41976328+ImKyle4815@users.noreply.github.com> Date: Thu, 15 Aug 2019 20:32:30 -0700 Subject: [PATCH] Update life.js --- data/life/life.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/data/life/life.js b/data/life/life.js index 576bf3a2..8ef661d0 100644 --- a/data/life/life.js +++ b/data/life/life.js @@ -2,7 +2,7 @@ // Card Conjurer, by Kyle Burton // //============================================// //define variables -var playerCount, startingLifeTotal, firstPlayerWide = false, lastPlayerWide = false, playerList = [], rowHeight = 0, columnWidth = 0, rowCount = 0, isFullscreen = true, touchscreen = false, loop, activePlayerBoxes = [] +var playerCount, startingLifeTotal, firstPlayerWide = false, lastPlayerWide = false, playerList = [], rowHeight = 0, columnWidth = 0, rowCount = 0, isFullscreen = true, touchscreen = false, loop = false, activePlayerBoxes = [] if ((typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1)) { isMobile = true } @@ -324,6 +324,7 @@ function updateMouseCoordinates() { } function endMouseCoordinates() { clearTimeout(loop) + loop = false clearTimers() clicking = false } @@ -406,7 +407,9 @@ function singleClick() { drawPlayerBox(i) } } - setTimeout(heldDown, 100) + if (loop == false) { + loop = setTimeout(heldDown, 100) + } } function heldDown() { if (clicking) { @@ -474,6 +477,6 @@ function heldDown() { playerList[i - 1].holdTime = 0 } } - setTimeout(heldDown, 100) + loop = setTimeout(heldDown, 100) } } \ No newline at end of file