how do I trigger a function after x seconds in pygame?? i have seen the "pygame.time.set_timer(event,ms), but i want to trigger a function instead of an event.
hoping for a quick reply thanks...

Recommended Answers

All 2 Replies

Investigate pygame.USEREVENT for your event.

you could also write a function such as:

import time

def function(self):
    while : 
        time.sleep(1) #you put the time to wait in seconds here
        #rest of function

you could use time.sleep() in a number of scenarios...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.