| 38 | |
| 39 | # Pipe class |
| 40 | class Pipe: |
| 41 | def __init__(self): |
| 42 | self.image = pipe_image |
| 43 | self.x = screen_width |
| 44 | self.y = random.randint(150, screen_height - 150) |
| 45 | self.vel = 5 |
| 46 | |
| 47 | def update(self): |
| 48 | self.x -= self.vel |
| 49 | |
| 50 | def draw(self, screen): |
| 51 | screen.blit(self.image, (self.x, self.y)) |
| 52 | screen.blit( |
| 53 | pygame.transform.flip(self.image, False, True), |
| 54 | (self.x, self.y - screen_height), |
| 55 | ) |
| 56 | |
| 57 | |
| 58 | def main(): |