MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / Segment

Class Segment

DemoPrograms/Demo_PyGame_Snake_Game.py:34–50  ·  view source on GitHub ↗

Class to represent one segment of the snake.

Source from the content-addressed store, hash-verified

32
33
34class 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

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected