groups
This commit is contained in:
12
main.py
12
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user