Skip to content
Advertisement

How to change room in this game (arcade Python)

I am developing a simple platformer game using the arcade game library of Python. I am still new to this, but I have tried to use as much object oriented programming as I could. I have successfully setup two “rooms” or levels of the game. However, I cannot figure out how to move to the second room after finishing the first room. Here is my code:

JavaScript

If I delete self.gameover= True from the def update, the program transitions into room 2 but the sprites aren’t loaded properly and player position is not reset.

Advertisement

Answer

  • replace self.game_over = True with self.setup()
  • Move creation of rooms from setup to __init__

Updated script:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement