Skip to content

Commit

Permalink
Minor Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubiidev-IPad authored Oct 15, 2024
1 parent 4bda5a6 commit 06ec3f5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ <h1>Welcome to HTML Dash!</h1>
const startButton = document.getElementById('start-button');
let isJumping = false; // Jump state
let playerBottom = 0; // Player position from bottom
let jumpHeight = 0; // Variable to control jump height

// Start game function
function startGame() {
Expand All @@ -88,7 +89,7 @@ <h1>Welcome to HTML Dash!</h1>
obstacle.style.left = '100vw'; // Start from the right
game.appendChild(obstacle);
moveObstacle(obstacle); // Move the obstacle
}, 2000); // Every 2 seconds
}, 3000); // Every 3 seconds (slowed down)
}

// Move the obstacle across the screen
Expand All @@ -99,7 +100,7 @@ <h1>Welcome to HTML Dash!</h1>
clearInterval(obstacleInterval);
game.removeChild(obstacle);
} else {
obstacleLeft -= 2; // Move left
obstacleLeft -= 1; // Move left slower
obstacle.style.left = obstacleLeft + 'vw'; // Update position
checkCollision(obstacle); // Check for collisions
}
Expand Down Expand Up @@ -137,9 +138,9 @@ <h1>Welcome to HTML Dash!</h1>
});

function jump() {
let jumpHeight = 0; // Reset jump height
jumpHeight = 0; // Reset jump height
const jumpInterval = setInterval(() => {
if (jumpHeight >= 100) { // Jump max height
if (jumpHeight >= 150) { // Increase jump max height
clearInterval(jumpInterval); // Stop jump
fall(); // Call fall function
} else {
Expand Down

0 comments on commit 06ec3f5

Please sign in to comment.