From 35556c4c3b31fa55a5da9281a4e9995314c0c4c1 Mon Sep 17 00:00:00 2001 From: Kyle <41976328+ImKyle4815@users.noreply.github.com> Date: Thu, 15 Aug 2019 20:05:17 -0700 Subject: [PATCH] Update life.js --- data/life/life.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/data/life/life.js b/data/life/life.js index e34e4a1c..9df98ae5 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 +var playerCount, startingLifeTotal, firstPlayerWide = false, lastPlayerWide = false, playerList = [], rowHeight = 0, columnWidth = 0, rowCount = 0, isFullscreen = true, touchscreen = false, loop, activePlayerBoxes = [] if ((typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1)) { isMobile = true } @@ -243,6 +243,7 @@ function updatePlayerBoxes() { playerList[n - 1].life += lifeAdjust // console.log(lifeAdjust) // alert("Their life total is now " + playerList[n - 1].life) + activePlayerBoxes[activePlayerBoxes.length] = n drawPlayerBox(n) } //else { // playerList[n - 1].firection = "none" @@ -254,6 +255,13 @@ function updatePlayerBoxes() { // loop = setTimeout(updatePlayerBoxes, 100) // } } + for (var i = 1; i <= playerList.length; i ++) { + if (!activePlayerBoxes.includes(i)) { + playerList[i - 1].firection = "none" + playerList[i - 1].holdTime = 0 + } + } + activePlayerBoxes = [] setTimeout(updatePlayerBoxes, 100) } // setTimeout(function() {alert(touchX[0] + ", " + touchY[0] + " & " + touchX[1] + ", " + touchY[1])}, 1000) @@ -321,6 +329,8 @@ function startMouseCoordinates() { function updateMouseCoordinates() { touchX[0] = event.clientX touchY[0] = event.clientY + // touchX[1] = 50 + // touchY[1] = 50 //For testing purposes only } function endMouseCoordinates() { clearTimeout(loop)