I'm new to Pygame, so I'm still struggling with the whole "events" concept.
Basically, my current challenge is to:
Get pygame.event.get() working outside of the main loop so that I can allow for the player to proceed from one part of the game to the next (by pressing spacebar, for instance).
Figure out a way to organize the different functions of the game in the main thread so that they don't just keep looping over and over and overriding each other.
I understand how the main loop is crucial in many games, but I can't grasp how I could use it in this game when the game involves moving from one event to the next (it's a relatively simple text-based game where you go through different menus and select choices to progress). Since the main loop is a while loop, everything within it keeps repeating over and over, so how is it possible for me to go from one screen to the next without the screens infinitely clashing with each other?
For instance, I have an introductory sequence (an Intro() function) that is supposed to run first before anything else and then allow you to proceed to the actual game by hitting the spacebar. I have placed the Intro() function before the actual main loop to prevent it from looping. However, pygame.event.get() doesn't work inside it (bear in mind that I already have such an event "for" loop in the main loop), and I want to be able to progress to the game itself by hitting the spacebar.
It would be great if someone can enlighten me and give me a lesson in logic and threading.
Thanks.