Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #objects
- car1 = car([370,430])
- #The Loop
- 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_LEFT:
- car1.x_change = -5
- elif event.key == pygame.K_RIGHT:
- car1.x_change = 5
- if event.type == pygame.KEYUP:
- if event.key == pygame.K_LEFT or event.key == pygame.K_RIGHT:
- car1.x_change = 0
- car1.x += car1.x_change
- window.fill((0, 0, 0))
- window.blit(car1.image,[car1.x,car1.y])
- pygame.display.update()
- clock.tick(60)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement