def drawSprites(): global mushrooms, ploppers, snakes, spiders, gamePaused, gamePlaying for f in range(len(mushrooms)): mushrooms[f].draw(window) for f in range(len(ploppers)): ploppers[f].draw(window) if gamePlaying: player.draw(window) for f in range(len(snakes)): snakes[f].draw(window) for f in range(len(spiders)): spiders[f].draw(window, fontSmaller) if gamePaused: gamePaused = Info(130, 280, pygame.image.load(os.path.join("centipede", "paused.png"))) gamePaused.draw(window)
# removed destroyed elements in the arrays below # lasers are removed within the laserCanon class in the draw method mushrooms = removeDestroyed(mushrooms) snakes = removeDestroyed(snakes) ploppers = removeDestroyed(ploppers) spiders = removeDestroyed(spiders) # go the mushroom plopper! createMushrooms = len(mushrooms) < MUSHROOM_MINIMUM # draw the sprite's drawSprites() else: # check to see if player wants to quit game. gamePlaying will allow the player to PAUSE the game only if it is playing pauseExitCheck() # displaying game over gameOverDisplayTimer -= 1 gamePlaying = False updateHiScore() gameOver.draw(window) # the score will be with you - always panelUpdate(window, SCREEN_WIDTH, SCREEN_HEIGHT, DISPLAY_PANEL, player, HIGH_SCORE) pygame.display.flip()