Spaces:
Running
Running
I think you messed up the controls take another look
Browse files- index.html +10 -11
index.html
CHANGED
|
@@ -479,7 +479,7 @@
|
|
| 479 |
document.addEventListener('keydown', (e) => {
|
| 480 |
switch (e.key) {
|
| 481 |
case 'ArrowUp':
|
| 482 |
-
if (direction !== '
|
| 483 |
break;
|
| 484 |
case 'ArrowLeft':
|
| 485 |
if (direction !== 'right') nextDirection = 'left';
|
|
@@ -487,7 +487,10 @@
|
|
| 487 |
case 'ArrowRight':
|
| 488 |
if (direction !== 'left') nextDirection = 'right';
|
| 489 |
break;
|
| 490 |
-
case '
|
|
|
|
|
|
|
|
|
|
| 491 |
isPaused = !isPaused;
|
| 492 |
if (isPaused) {
|
| 493 |
bgMusic.pause();
|
|
@@ -522,11 +525,11 @@
|
|
| 522 |
}
|
| 523 |
} else {
|
| 524 |
// Vertical swipe
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
}
|
| 531 |
|
| 532 |
touchStartX = 0;
|
|
@@ -581,9 +584,5 @@
|
|
| 581 |
}, { once: true });
|
| 582 |
});
|
| 583 |
</script>
|
| 584 |
-
'down') nextDirection = 'up';
|
| 585 |
-
break;
|
| 586 |
-
case 'ArrowDown':
|
| 587 |
-
if (direction !==
|
| 588 |
</body>
|
| 589 |
</html>
|
|
|
|
| 479 |
document.addEventListener('keydown', (e) => {
|
| 480 |
switch (e.key) {
|
| 481 |
case 'ArrowUp':
|
| 482 |
+
if (direction !== 'down') nextDirection = 'up';
|
| 483 |
break;
|
| 484 |
case 'ArrowLeft':
|
| 485 |
if (direction !== 'right') nextDirection = 'left';
|
|
|
|
| 487 |
case 'ArrowRight':
|
| 488 |
if (direction !== 'left') nextDirection = 'right';
|
| 489 |
break;
|
| 490 |
+
case 'ArrowDown':
|
| 491 |
+
if (direction !== 'up') nextDirection = 'down';
|
| 492 |
+
break;
|
| 493 |
+
case ' ':
|
| 494 |
isPaused = !isPaused;
|
| 495 |
if (isPaused) {
|
| 496 |
bgMusic.pause();
|
|
|
|
| 525 |
}
|
| 526 |
} else {
|
| 527 |
// Vertical swipe
|
| 528 |
+
if (diffY > 0 && direction !== 'down') {
|
| 529 |
+
nextDirection = 'up';
|
| 530 |
+
} else if (diffY < 0 && direction !== 'up') {
|
| 531 |
+
nextDirection = 'down';
|
| 532 |
+
}
|
| 533 |
}
|
| 534 |
|
| 535 |
touchStartX = 0;
|
|
|
|
| 584 |
}, { once: true });
|
| 585 |
});
|
| 586 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 587 |
</body>
|
| 588 |
</html>
|