MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / Player

Class Player

projects/PONG/main.py:13–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11
12
13class Player(Block):
14 def __init__(self, path, x_pos, y_pos, speed):
15 super().__init__(path, x_pos, y_pos)
16 self.speed = speed
17 self.movement = 0
18 self.x = x_pos
19
20 def screen_constrain(self):
21 if self.rect.top <= 0:
22 self.rect.top = 0
23 if self.rect.bottom >= HEIGHT:
24 self.rect.bottom = HEIGHT
25
26 def update(self, bll_group):
27 self.rect.y += self.movement
28 self.screen_constrain()
29
30
31class Opponent(Block):

Callers 1

main.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected