When my player reaches at the end of the map, I want it to enter to next level. I've created first level and it all works fine. All I want to do is that when player finishes 1st level I want to load another map on which it can move forward. But I'm not able to understand how to do it. Here is piece of my code
def runGame(theGame):
theGame.clock.tick(FPS)
# This function consists code for Events
theGame.events()
# This function consists code from enemy hit events
theGame.hit_or_not()
# This function consists code for player movements
theGame.movements()
# This function consists code for drawing the sprites over the screen
theGame.redrawGameWindow()
def readyGame(run, gameOver):
game = Game()
while run:
runGame(game)
keys = pygame.key.get_pressed()
if keys[pygame.K_x]:
game = Game()
elif keys[pygame.K_ESCAPE]:
run = False
pygame.event.pump()
if gameOver:
runGame(game)
readyGame(True, False)
And here is my whole code which is responsible for my first level: https://pastebin.com/yRb8T6ku (Game Class)
Do I have to create another class for second level like I did for first level?