Drive Cars Down A | Hill Script

# Draw screen.fill((255, 255, 255)) space.debug_draw(draw_options) for car in cars: car.draw(screen)

# Main loop running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False if event.type == pygame.KEYDOWN: if event.key == pygame.K_SPACE: cars.append(Car(80, 480)) drive cars down a hill script

import pymunk import pymunk.pygame_util import pygame import sys import random # Draw screen

for i in range(len(hill_points)-1): segment = pymunk.Segment(space.static_body, hill_points[i], hill_points[i+1], 2) segment.friction = 0.8 segment.elasticity = 0.5 space.add(segment) # Draw screen.fill((255

# Initialize Pygame pygame.init() WIDTH, HEIGHT = 800, 600 screen = pygame.display.set_mode((WIDTH, HEIGHT)) clock = pygame.time.Clock()

pygame.display.flip() clock.tick(60)

# Create cars cars = [Car(80, 480), Car(120, 460), Car(160, 435)]