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