| Level Navigation: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18⚡ | 19 |
CHALLENGE LEVEL
User Story: As a developer, I want to implement advanced features so that I can challenge myself and create a more impressive game.
Choose from these advanced challenges to extend your game.
Difficulty: ⭐ Easy
Add a game over condition when lives reach 0.
Instructions:
lives <= 0if (lives <= 0) {
return <GameOverScreen score={score} />
}
Difficulty: ⭐ Easy
Add a button to restart the game.
Instructions:
restartGame() functionfunction restartGame() {
setScore(0)
setLives(3)
setAppleSize(100)
setAppleX(0)
setAppleY(0)
}
Difficulty: ⭐⭐ Medium
Track and display the highest score using browser storage.
Instructions:
localStorage.getItem() and setItem()highScore// Load high score on mount
const [highScore, setHighScore] = useState(() => {
return parseInt(localStorage.getItem('highScore')) || 0
})
// Save when game ends
if (score > highScore) {
setHighScore(score)
localStorage.setItem('highScore', score)
}
Difficulty: ⭐⭐ Medium
Add sound effects for clicks, misses, and winning.
Instructions:
<audio> elementsconst clickSound = new Audio('/click.mp3')
function clickTarget(event) {
event.stopPropagation();
clickSound.play()
setScore(score + 1)
// ... rest of function
}
Difficulty: ⭐⭐⭐ Hard
Add a timer that counts down, creating urgency.
Instructions:
timeRemaininguseEffect with setInterval for countdownuseEffect(() => {
if (timeRemaining > 0) {
const timer = setInterval(() => {
setTimeRemaining(time => time - 1)
}, 1000)
return () => clearInterval(timer)
}
}, [timeRemaining])
Difficulty: ⭐⭐⭐ Hard
Add Easy/Medium/Hard difficulty levels.
Instructions:
Difficulty: ⭐⭐⭐ Hard
Add smooth animations for apple movement and size changes.
Instructions:
.apple-target {
transition: all 0.3s ease-in-out;
}
Difficulty: ⭐⭐ Medium
Make the game work well on mobile devices.
Instructions: