When my player reaches at the end of the map, I want it to enter to the next level. I've created the 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)
Here is my whole code which is responsible for my 1st level please kindly check it - https://pastebin.com/zMFetAd6 (Game Class)
Do I have to create another class for 2nd level like I did for the 1st level?
Can anyone please help me out in this issue? Thanks in advance!