Class to represent one segment of the snake.
| 32 | |
| 33 | |
| 34 | class Segment(pygame.sprite.Sprite): |
| 35 | """ Class to represent one segment of the snake. """ |
| 36 | # -- Methods |
| 37 | # Constructor function |
| 38 | |
| 39 | def __init__(self, x, y): |
| 40 | # Call the parent's constructor |
| 41 | super().__init__() |
| 42 | |
| 43 | # Set height, width |
| 44 | self.image = pygame.Surface([segment_width, segment_height]) |
| 45 | self.image.fill(WHITE) |
| 46 | |
| 47 | # Make our top-left corner the passed-in location. |
| 48 | self.rect = self.image.get_rect() |
| 49 | self.rect.x = x |
| 50 | self.rect.y = y |
| 51 | |
| 52 | # --------------------------- GUI Setup & Create Window ------------------------------- |
| 53 |
no outgoing calls
no test coverage detected