Um... I need some help with pausing for a set amount of time without stopping the game
Basically I want to make a clicker game, but in Python's terminal. So I need a way to make it wait a set amount of time before delivering the currency (auto click thing), is there any way I can do that?
The most common way to do this is through what's called an event loop. A game is typically structured entirely around this loop, and its job is to handle any sort of realtime events. I'd suggest you read up more if you want to familiarize yourself with this model.
You might be able to get away with running this loop through a new thread, but honestly it's better to implement it as the core of your game.
@noway15 There's two main parts to an event loop, the event and the loop. Big surprise, I know.
There's a data structure, normally a queue, that holds all of the events that need to be processed. Whenever something happens, you put it into the event queue.
Then, an infinite loop checks if anything is in the event queue. It processes all of the events until the queue is empty. This infinite loop is the event loop.
Your your use case, I'm assuming you're handling key presses rather than mouse clicks. When a key is pressed, you'd add a key press event to the event queue. The next time the event loop iterates, it will see the new event and process it. You can tell your event queue to add to the score when it sees a key press event.
Now for what you were originally asking for: non-interupting time delay. I'll give you some Pythonic pseudocode to work with. It's hard for me to explain it, but hopefully you can see what's going on here.