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:
@@ -314,7 +314,8 @@ window.addEventListener("mousemove", updateMouseCoordinates, true)
|
|||||||
window.addEventListener("mouseup", endMouseCoordinates, true)
|
window.addEventListener("mouseup", endMouseCoordinates, true)
|
||||||
function startMouseCoordinates() {
|
function startMouseCoordinates() {
|
||||||
clicking = true
|
clicking = true
|
||||||
singleClick()
|
// singleClick()
|
||||||
|
singleTap()
|
||||||
}
|
}
|
||||||
function updateMouseCoordinates() {
|
function updateMouseCoordinates() {
|
||||||
touchX[0] = event.clientX
|
touchX[0] = event.clientX
|
||||||
@@ -362,6 +363,73 @@ function endTouch() {
|
|||||||
clearTimers()
|
clearTimers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function singleTap() {
|
||||||
|
var playerBoxBounds = event.target.getBoundingClientRect()
|
||||||
|
var tappedPlayerBox = playerList[event.target.customVarID - 1]
|
||||||
|
var lifeAdjust = 0
|
||||||
|
if (tappedPlayerBox.rotation == 0 || tappedPlayerBox.rotation == 180) {
|
||||||
|
if (touchX[touchX.length - 1] > playerBoxBounds.width / 2 + playerBoxBounds.x) {
|
||||||
|
lifeAdjust = 1
|
||||||
|
} else {
|
||||||
|
lifeAdjust = -1
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (touchY[touchY.length - 1] > playerBoxBounds.height / 2 + playerBoxBounds.y) {
|
||||||
|
lifeAdjust = 1
|
||||||
|
} else {
|
||||||
|
lifeAdjust = -1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tappedPlayerBox.rotation == 180 || tappedPlayerBox.rotation == 270) {
|
||||||
|
lifeAdjust *= -1
|
||||||
|
}
|
||||||
|
direction = lifeAdjust + ""
|
||||||
|
tappedPlayerBox.life += lifeAdjust
|
||||||
|
drawPlayerBox(tappedPlayerBox.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function singleClick() {
|
function singleClick() {
|
||||||
@@ -480,4 +548,4 @@ function heldDown() {
|
|||||||
loop = setTimeout(heldDown, 100)
|
loop = setTimeout(heldDown, 100)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Updated
|
//Updated for real
|
Reference in New Issue
Block a user