Update life.js

This commit is contained in:
Kyle
2019-08-10 16:46:21 -07:00
parent 08d849a4f2
commit 3130967f31

View File

@@ -6,7 +6,7 @@ var playerCount, startingLifeTotal, firstPlayerWide = false, lastPlayerWide = fa
if ((typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1)) {
isMobile = true
}
window.addEventListener("touchstart", switchToTouchEvents)
window.addEventListener("touchstart", switchToTouchEvents, true)
//This function sets everything up
function fullscreen() {
//Full screen!
@@ -144,8 +144,8 @@ function playerBox(playerBoxID, canvasRotation, wide) {
this.canvas.classList.add("widePlayerBox")
}
document.getElementById("mainGrid").appendChild(this.canvas)
this.canvas.addEventListener("mousedown", decoyMouseDownFunction)
document.addEventListener("mouseup", decoyMouseUpFunction)
this.canvas.addEventListener("mousedown", decoyMouseDownFunction, true)
document.addEventListener("mouseup", decoyMouseUpFunction, true)
}
function decoyMouseDownFunction() {
alert("IT'S STILL CLICKING")
@@ -224,16 +224,16 @@ function updateBackgroundColor(color) {
function switchToTouchEvents() {
window.removeEventListener("touchstart", switchToTouchEvents)
document.removeEventListener("mouseup", decoyMouseUpFunction)
alert("switch!!!!")
window.removeEventListener("touchstart", switchToTouchEvents, true)
document.removeEventListener("mouseup", decoyMouseUpFunction, true)
for (var i = 1; i <= playerCount; i++) {
alert(playerList[i - 1].canvas.removeEventListener("mousedown", decoyMouseDownFunction))
alert("Currently being dumb: " + i)
playerList[i - 1].canvas.removeEventListener("mousedown", decoyMouseDownFunction, true)
playerList[i - 1].canvas.addEventListener("touchstart", function() {
mouseDownPlayerBox(this, event.clientX, event.clientY)
})
}, true)
playerList[i - 1].canvas.addEventListener("touchend", function() {
mouseUpPlayerBox(this)
})
}, true)
}
}