SHOW:
|
|
- or go back to the newest paste.
| 1 | import pygame | |
| 2 | #Need to now import Random | |
| 3 | import random | |
| 4 | pygame.init() | |
| 5 | ||
| 6 | #General Variables | |
| 7 | running = True | |
| 8 | window = pygame.display.set_mode((400,600)) | |
| 9 | clock = pygame.time.Clock() | |
| 10 | ||
| 11 | #New Variables | |
| 12 | randx = random.randrange(0, 300) | |
| 13 | randy = 0 | |
| 14 | score = 0 | |
| 15 | ||
| 16 | pygame.display.set_caption('Race car')
| |
| 17 | ||
| 18 | class car(pygame.sprite.Sprite): | |
| 19 | def __init__(self,location): | |
| 20 | pygame.sprite.Sprite.__init__(self) | |
| 21 | self.image = pygame.image.load('racecar.png').convert_alpha()
| |
| 22 | self.x_change = 0 | |
| 23 | self.x = 370 | |
| 24 | self.y = 430 | |
| 25 | - | car1 = car([370,430]) |
| 25 | + | |
| 26 | car1 = car([370,430]) |