api-ix commited on
Commit
b65b155
·
verified ·
1 Parent(s): fe87710

Update script.js

Browse files
Files changed (1) hide show
  1. script.js +4 -5
script.js CHANGED
@@ -31,11 +31,10 @@ function jump() {
31
  }, 20);
32
  }
33
 
34
- document.addEventListener('keydown', (event) => {
35
- if (event.code === 'Space') {
36
- jump();
37
- }
38
- });
39
 
40
  function moveObstacle() {
41
  obstaclePosition -= 5;
 
31
  }, 20);
32
  }
33
 
34
+ // Listen for touch events
35
+ document.addEventListener('touchstart', (event) => {
36
+ jump();
37
+ }, { passive: true });
 
38
 
39
  function moveObstacle() {
40
  obstaclePosition -= 5;