diff --git a/data/life/life.js b/data/life/life.js index 030caafe..94f43694 100644 --- a/data/life/life.js +++ b/data/life/life.js @@ -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) } } \ No newline at end of file