codex-lv3-may-2025

Level Navigation: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18⚡ 19

Level 18: Challenge Extensions ⚡

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.

What You’ll Do

Choose from these advanced challenges to extend your game.

Challenge Options

Challenge 1: Game Over Condition

Difficulty: ⭐ Easy

Add a game over condition when lives reach 0.

Instructions:

Hint: Conditional structure
if (lives <= 0) {
  return <GameOverScreen score={score} />
}

Challenge 2: Restart Functionality

Difficulty: ⭐ Easy

Add a button to restart the game.

Instructions:

Hint: Reset function
function restartGame() {
  setScore(0)
  setLives(3)
  setAppleSize(100)
  setAppleX(0)
  setAppleY(0)
}

Challenge 3: High Score with localStorage

Difficulty: ⭐⭐ Medium

Track and display the highest score using browser storage.

Instructions:

Hint: localStorage usage
// 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)
}

Challenge 4: Sound Effects

Difficulty: ⭐⭐ Medium

Add sound effects for clicks, misses, and winning.

Instructions:

Hint: Playing sounds
const clickSound = new Audio('/click.mp3')

function clickTarget(event) {
  event.stopPropagation();
  clickSound.play()
  setScore(score + 1)
  // ... rest of function
}

Challenge 5: Timer/Countdown Mode

Difficulty: ⭐⭐⭐ Hard

Add a timer that counts down, creating urgency.

Instructions:

Hint: Timer with useEffect
useEffect(() => {
  if (timeRemaining > 0) {
    const timer = setInterval(() => {
      setTimeRemaining(time => time - 1)
    }, 1000)
    
    return () => clearInterval(timer)
  }
}, [timeRemaining])

Challenge 6: Difficulty Levels

Difficulty: ⭐⭐⭐ Hard

Add Easy/Medium/Hard difficulty levels.

Instructions:


Challenge 7: Animations

Difficulty: ⭐⭐⭐ Hard

Add smooth animations for apple movement and size changes.

Instructions:

Hint: CSS transitions
.apple-target {
  transition: all 0.3s ease-in-out;
}

Challenge 8: Mobile Support

Difficulty: ⭐⭐ Medium

Make the game work well on mobile devices.

Instructions:


✅ Check

  1. Choose at least one challenge to implement
  2. Test your new feature thoroughly
  3. Update your README with new features
  4. Commit your changes with descriptive messages
  5. Consider adding screenshots or GIFs