ĀæComo puedo hacer para que pase un evento cada cierto tiempo ? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

ĀæComo puedo hacer para que pase un evento cada cierto tiempo ?

En pygame como puedo hacer para que pase algĆŗn evento o instruccion cada cierto tiempo Vi que estĆ” el pygame.time.set_timer() pero no entiendo muy bien como funciona

11th Nov 2018, 5:58 PM
JeaLuq
JeaLuq - avatar
1 Resposta
+ 1
pygame.time.set_timer(eventid, milliseconds) the argument eventid you pass to pygame.time.set_timer should be any integer between 24 and 32. .. If you want to play a sound every 6.5 seconds using the event queue, simpy call pygame.time.set_timer once(!): PLAYSOUNDEVENT = USEREVENT + 1 - - - pygame.time.set_timer(PLAYSOUNDEVENT, 6500) and check the event queue for this event in your main loop: while whatever: # main loop ... # event handling if pygame.event.get(PLAYSOUNDEVENT): # check event queue contains PLAYSOUNDEVENT nyansoundm.play() - - - Source: https://stackoverflow.com/questions/15056444/pygame-time-set-timer-confusion
24th Nov 2018, 3:08 AM
Gordon
Gordon - avatar