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:
@@ -6,6 +6,7 @@ var playerCount, startingLifeTotal, firstPlayerWide = false, lastPlayerWide = fa
|
|||||||
if ((typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1)) {
|
if ((typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1)) {
|
||||||
isMobile = true
|
isMobile = true
|
||||||
}
|
}
|
||||||
|
window.addEventListener("touchstart", switchToTouchEvents)
|
||||||
//This function sets everything up
|
//This function sets everything up
|
||||||
function fullscreen() {
|
function fullscreen() {
|
||||||
//Full screen!
|
//Full screen!
|
||||||
@@ -145,7 +146,6 @@ function playerBox(playerBoxID, canvasRotation, wide) {
|
|||||||
document.getElementById("mainGrid").appendChild(this.canvas)
|
document.getElementById("mainGrid").appendChild(this.canvas)
|
||||||
this.canvas.addEventListener("mousedown", decoyMouseDownFunction)
|
this.canvas.addEventListener("mousedown", decoyMouseDownFunction)
|
||||||
document.addEventListener("mouseup", decoyMouseUpFunction)
|
document.addEventListener("mouseup", decoyMouseUpFunction)
|
||||||
window.addEventListener("touchstart", switchToTouchEvents)
|
|
||||||
}
|
}
|
||||||
function decoyMouseDownFunction() {
|
function decoyMouseDownFunction() {
|
||||||
alert("IT'S STILL CLICKING")
|
alert("IT'S STILL CLICKING")
|
||||||
@@ -224,12 +224,14 @@ function updateBackgroundColor(color) {
|
|||||||
|
|
||||||
|
|
||||||
function switchToTouchEvents() {
|
function switchToTouchEvents() {
|
||||||
document.removeEventListener("mousedown", decoyMouseDownFunction)
|
window.removeEventListener("touchstart", switchToTouchEvents)
|
||||||
document.removeEventListener("mouseup", decoyMouseUpFunction)
|
for (var i = 1; i <= playerCount; i++) {
|
||||||
document.addEventListener("touchstart", function() {
|
playerList[i - 1].canvas.removeEventListener("mousedown", decoyMouseDownFunction)
|
||||||
mouseDownPlayerBox(this, event.clientX, event.clientY)
|
playerList[i - 1].canvas.addEventListener("touchstart", function() {
|
||||||
})
|
mouseDownPlayerBox(this, event.clientX, event.clientY)
|
||||||
document.addEventListener("touchend", function() {
|
})
|
||||||
mouseUpPlayerBox(this)
|
playerList[i - 1].canvas.addEventListener("touchend", function() {
|
||||||
})
|
mouseUpPlayerBox(this)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user