Update life.js

This commit is contained in:
Kyle
2019-08-15 17:51:01 -07:00
parent b0a9d0c808
commit 50c655a8a5

View File

@@ -182,7 +182,9 @@ function rollRNG() {
document.getElementById("rngOutput").innerHTML = Math.floor(Math.random() * (parseInt(document.getElementById("inputRNGMax").value) - parseInt(document.getElementById("inputRNGMin").value) + 1) + parseInt(document.getElementById("inputRNGMin").value))
}
function updatePlayerBoxes() {
alert("did I click?")
if (clicking) {
alert("yes I did!")
//Make a list of the touch locations
for (var i = 0; i < touchX.length; i++) {
for (var n = 1; n <= playerList.length; n ++) {
@@ -237,6 +239,8 @@ function updatePlayerBoxes() {
}
}
playerList[n - 1].life += lifeAdjust
alert("I clicked on " + n + "!")
alert("Their life total is now " + playerList[n - 1].life)
drawPlayerBox(n)
break
} else {
@@ -335,7 +339,6 @@ function startTouch() {
if (event.touches.length > 0) {
if (!clicking) {
updatePlayerBoxes()
alert("just ran it?")
}
clicking = true
}
@@ -352,6 +355,5 @@ function endTouch() {
clicking = false
clearTimeout(loop)
clearTimers()
alert("just cancelled everything")
}
}