Opening project sandbox
Preparing the editor and runtime...
Preparing the editor and runtime...
Loading project sandbox...
Start from a blank editor and follow the directions below.
0/4 passed
Run your code, then check each checkpoint before moving on.
1. Move ship, fire bullets.
Not checkedExample pattern (not the full solution):
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
player.x -= speed
if keys[pygame.K_RIGHT]:
player.x += speed2. Spawn enemies.
Not checkedExample pattern (not the full solution):
spawn_timer += 1
if spawn_timer >= 30:
spawn_timer = 0
objects.append(make_object(random.randint(0, W - 20)))3. Hit enemies for score.
Not checkedExample pattern (not the full solution):
for obstacle in obstacles:
if player.colliderect(obstacle):
game_over = True4. Lose lives on misses/hits.
Not checkedExample pattern (not the full solution):
if missed_target:
lives -= 1
if lives <= 0:
game_over = True