mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-27 21:31:39 -05:00
Update life.js
This commit is contained in:
@@ -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
|
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)) {
|
if ((typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1)) {
|
||||||
isMobile = true
|
isMobile = true
|
||||||
}
|
}
|
||||||
@@ -243,6 +243,7 @@ function updatePlayerBoxes() {
|
|||||||
playerList[n - 1].life += lifeAdjust
|
playerList[n - 1].life += lifeAdjust
|
||||||
// console.log(lifeAdjust)
|
// console.log(lifeAdjust)
|
||||||
// alert("Their life total is now " + playerList[n - 1].life)
|
// alert("Their life total is now " + playerList[n - 1].life)
|
||||||
|
activePlayerBoxes[activePlayerBoxes.length] = n
|
||||||
drawPlayerBox(n)
|
drawPlayerBox(n)
|
||||||
} //else {
|
} //else {
|
||||||
// playerList[n - 1].firection = "none"
|
// playerList[n - 1].firection = "none"
|
||||||
@@ -254,6 +255,13 @@ function updatePlayerBoxes() {
|
|||||||
// loop = setTimeout(updatePlayerBoxes, 100)
|
// 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(updatePlayerBoxes, 100)
|
||||||
}
|
}
|
||||||
// setTimeout(function() {alert(touchX[0] + ", " + touchY[0] + " & " + touchX[1] + ", " + touchY[1])}, 1000)
|
// setTimeout(function() {alert(touchX[0] + ", " + touchY[0] + " & " + touchX[1] + ", " + touchY[1])}, 1000)
|
||||||
@@ -321,6 +329,8 @@ function startMouseCoordinates() {
|
|||||||
function updateMouseCoordinates() {
|
function updateMouseCoordinates() {
|
||||||
touchX[0] = event.clientX
|
touchX[0] = event.clientX
|
||||||
touchY[0] = event.clientY
|
touchY[0] = event.clientY
|
||||||
|
// touchX[1] = 50
|
||||||
|
// touchY[1] = 50 //For testing purposes only
|
||||||
}
|
}
|
||||||
function endMouseCoordinates() {
|
function endMouseCoordinates() {
|
||||||
clearTimeout(loop)
|
clearTimeout(loop)
|
||||||
|
Reference in New Issue
Block a user