Opening project sandbox
Preparing the editor and runtime...
Preparing the editor and runtime...
Start from a blank editor and follow the directions below.
0/4 passed
Run your code, then check each checkpoint before moving on.
1. Add gravity and jump.
Not checkedExample pattern (not the full solution):
if keys[pygame.K_SPACE] and on_ground:
vy = -12
vy += 0.7
player.y += int(vy)2. Generate moving pipes.
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. Score by passing gaps.
Not checkedExample pattern (not the full solution):
if player_reached_goal:
score += 14. Restart with R.
Not checkedExample pattern (not the full solution):
if event.type == pygame.KEYDOWN and event.key == pygame.K_r:
# Reset key game state values
score = 0
game_over = False