This commit is contained in:
Kyle
2019-08-10 10:47:46 -07:00
parent 02b19796eb
commit de30c0c21b
2 changed files with 13 additions and 3 deletions

View File

@@ -54,7 +54,7 @@ function startGame() {
for (var i = 1; i <= playerCount; i++) {
if (playerList[i - 1].canvas.customVarMouseDown != "false") {
playerList[i - 1].canvas.customVarMouseDelay += 1
if (playerList[i - 1].canvas.customVarMouseDelay > 5 || playerList[i - 1].canvas.customVarMouseDelay == 1) {
if (playerList[i - 1].canvas.customVarMouseDelay > 5) {
if (playerList[i - 1].canvas.customVarMouseDown == "up") {
playerList[i - 1].life += 1
} else {
@@ -119,7 +119,6 @@ function configurePlayerBox(playerBoxID) {
currentPlayer.canvas.height = rowHeight
context.translate(currentPlayer.canvas.width / 2, currentPlayer.canvas.height / 2)
context.rotate(Math.PI / 180 * currentPlayer.rotation)
// drawPlayerBox(context, 0, 0)
}
function mouseDownPlayerBox(canvas, clickX = 0, clickY = 0) {
if (clickX > 0 && clickY > 0) {
@@ -127,26 +126,34 @@ function mouseDownPlayerBox(canvas, clickX = 0, clickY = 0) {
if (playerList[canvas.customVarID - 1].rotation == 0) {
if (clickX > playerBoxBounds.width / 2 + playerBoxBounds.x) {
canvas.customVarMouseDown = "up"
playerList[canvas.customVarID - 1].life += 1
} else {
canvas.customVarMouseDown = "down"
playerList[canvas.customVarID - 1].life -= 1
}
} else if (playerList[canvas.customVarID - 1].rotation == 90) {
if (clickY > playerBoxBounds.height / 2 + playerBoxBounds.y) {
canvas.customVarMouseDown = "up"
playerList[canvas.customVarID - 1].life += 1
} else {
canvas.customVarMouseDown = "down"
playerList[canvas.customVarID - 1].life -= 1
}
} else if (playerList[canvas.customVarID - 1].rotation == 180) {
if (clickX > playerBoxBounds.width / 2 + playerBoxBounds.x) {
canvas.customVarMouseDown = "down"
playerList[canvas.customVarID - 1].life -= 1
} else {
canvas.customVarMouseDown = "up"
playerList[canvas.customVarID - 1].life += 1
}
} else {
if (clickY > playerBoxBounds.height / 2 + playerBoxBounds.y) {
canvas.customVarMouseDown = "down"
playerList[canvas.customVarID - 1].life -= 1
} else {
canvas.customVarMouseDown = "up"
playerList[canvas.customVarID - 1].life += 1
}
}
}

View File

@@ -15,7 +15,7 @@
<meta name="theme-color" content="#64ca2f">
<!-- Other things -->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="minimal-ui, width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<!-- Here's the stuff that does things? -->
<script type='application/ld+json'>
{
@@ -127,6 +127,9 @@
.hidden {
display: none;
}
@viewport {
orientation: portrait;
}
</style>