Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 815 Bytes

File metadata and controls

32 lines (26 loc) · 815 Bytes

Week 17 – Student Tasks: Dodger

Task A: Survive as long as possible

  • Use left/right arrows to dodge falling enemies
  • Try to beat a score of 20!

Task B: Modifications

  1. Change number of enemies: for _ in range(10)
  2. Change starting speed: random.randint(3, 7) instead of (2, 5)
  3. Add lives system (3 hits before game over)

Task C: Add lives system

lives = 3

def update():
    global lives, game_over
    # ... in collision check:
    if collision_detected:
        lives -= 1
        e[1] = -50  # Move enemy back to top
        if lives <= 0:
            game_over = True

def draw():
    screen.draw.text(f"Lives: {lives}", (WIDTH-100, 20))

Success checklist

  • Understand how list stores multiple enemies
  • Can modify difficulty
  • Added lives or power-ups