MCPcopy Index your code
hub / github.com/geekcomputers/Python / Paddle

Class Paddle

brickout-game/brickout-game.py:110–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108
109
110class Paddle(object):
111 def __init__(self, screen, width, height, x, y):
112 self.__screen = screen
113 self._width = width
114 self._height = height
115 self._xLoc = x
116 self._yLoc = y
117 w, h = pygame.display.get_surface().get_size()
118 self.__W = w
119 self.__H = h
120
121 def draw(self):
122 """
123 draws the paddle onto screen.
124 """
125 pygame.draw.rect(
126 screen, (0, 0, 0), (self._xLoc, self._yLoc, self._width, self._height), 0
127 )
128
129 def update(self):
130 """
131 moves the paddle at the screen via mouse
132 """
133 x, y = pygame.mouse.get_pos()
134 if x >= 0 and x <= (self.__W - self._width):
135 self._xLoc = x
136
137
138"""

Callers 1

brickout-game.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected