Update life.js

This commit is contained in:
Kyle
2019-08-15 20:32:30 -07:00
parent 477d211b68
commit 1113f5f8eb

View File

@@ -2,7 +2,7 @@
// Card Conjurer, by Kyle Burton // // Card Conjurer, by Kyle Burton //
//============================================// //============================================//
//define variables //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)) { if ((typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1)) {
isMobile = true isMobile = true
} }
@@ -324,6 +324,7 @@ function updateMouseCoordinates() {
} }
function endMouseCoordinates() { function endMouseCoordinates() {
clearTimeout(loop) clearTimeout(loop)
loop = false
clearTimers() clearTimers()
clicking = false clicking = false
} }
@@ -406,7 +407,9 @@ function singleClick() {
drawPlayerBox(i) drawPlayerBox(i)
} }
} }
setTimeout(heldDown, 100) if (loop == false) {
loop = setTimeout(heldDown, 100)
}
} }
function heldDown() { function heldDown() {
if (clicking) { if (clicking) {
@@ -474,6 +477,6 @@ function heldDown() {
playerList[i - 1].holdTime = 0 playerList[i - 1].holdTime = 0
} }
} }
setTimeout(heldDown, 100) loop = setTimeout(heldDown, 100)
} }
} }