From c0e00ba3bbbb960aeef03c372471223140959229 Mon Sep 17 00:00:00 2001 From: Kyle <41976328+ImKyle4815@users.noreply.github.com> Date: Sat, 10 Aug 2019 16:58:19 -0700 Subject: [PATCH] Update life.js --- data/life/life.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/data/life/life.js b/data/life/life.js index 94f43694..ade5198b 100644 --- a/data/life/life.js +++ b/data/life/life.js @@ -6,7 +6,6 @@ var playerCount, startingLifeTotal, firstPlayerWide = false, lastPlayerWide = fa if ((typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1)) { isMobile = true } -window.addEventListener("touchstart", switchToTouchEvents, true) //This function sets everything up function fullscreen() { //Full screen! @@ -126,6 +125,7 @@ function startGame() { } }, 100) + window.addEventListener("touchstart", switchToTouchEvents, true) } function playerBox(playerBoxID, canvasRotation, wide) { @@ -148,7 +148,7 @@ function playerBox(playerBoxID, canvasRotation, wide) { document.addEventListener("mouseup", decoyMouseUpFunction, true) } function decoyMouseDownFunction() { - alert("IT'S STILL CLICKING") + console.log("IT'S STILL CLICKING") mouseDownPlayerBox(this, event.clientX, event.clientY) } function decoyMouseUpFunction() { @@ -224,10 +224,10 @@ function updateBackgroundColor(color) { function switchToTouchEvents() { + console.log("switching!") window.removeEventListener("touchstart", switchToTouchEvents, true) document.removeEventListener("mouseup", decoyMouseUpFunction, true) for (var i = 1; i <= playerCount; i++) { - 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) @@ -236,4 +236,6 @@ function switchToTouchEvents() { mouseUpPlayerBox(this) }, true) } -} \ No newline at end of file +} + +// setTimeout(function(){switchToTouchEvents()}, 2000) \ No newline at end of file