diff --git a/main.py b/main.py index 9367d50..1b4e301 100644 --- a/main.py +++ b/main.py @@ -20,7 +20,12 @@ def main(): time = pygame.time.Clock() dt = 0 - player = Player(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2) + updatable = pygame.sprite.Group() + drawable = pygame.sprite.Group() + + Player.containers = (updatable, drawable) + + player = Player(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2) while True: for event in pygame.event.get(): @@ -29,9 +34,10 @@ def main(): pygame.Surface.fill(screen, (0,0,0)) - player.update(dt) + updatable.update(dt) - player.draw(screen) + for drawing in drawable: + drawing.draw(screen) pygame.display.flip() #refresh screen diff --git a/player.py b/player.py index ec4618d..b114b97 100644 --- a/player.py +++ b/player.py @@ -4,6 +4,8 @@ from constants import PLAYER_RADIUS, PLAYER_SPEED, PLAYER_TURN_SPEED class Player(CircleShape): + #containers = [] + def __init__(self, x, y): super().__init__(x, y, PLAYER_RADIUS) self.rotation = 0