0

I'm creating a game and at the "start" screen I want it to pop up a picture after 45 seconds of not starting the game saying "Are you not going to play?"

However, I am completely lost at what to do, so if anyone have any clue on how to help that would be really appreciated.

2 Answers 2

1

You probably have a timer for your game, like this:

pygame.time.Clock.tick(fps) 

Each time your main loop runs, it ticks your fps, so your game could run smoothly.

Now, just add a variable, called, say, tick_counter

Now, in your code, do something like this:

fps = 25 tick_counter = 0 while RUNNING: #Do stuff, check for if close window, etc pygame.time.Clock.tick(fps) tick_counter += 1 if tick_counter >= 1125: #45 seconds if you are doing 25 fps. If your fps is different, just calculate it: 45 seconds = 45*fps #Pop up the picture! 
Sign up to request clarification or add additional context in comments.

Comments

0

You can set a timer and an event on the event queue. This answer shows how to do that. How can I detect if the user has double-clicked in pygame?

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.