Countdown timer in Pygame

后端 未结 7 1033
眼角桃花
眼角桃花 2020-11-22 03:31

I started using pygame and I want to do simple game. One of the elements which I need is countdown timer. How can I do the countdown time (eg 10 seconds) in PyGame?

7条回答
  •  北海茫月
    2020-11-22 04:14

    This is actually quite simple. Thank Pygame for creating a simple library!

    import pygame
    x=0
    while x < 10:
        x+=1
        pygame.time.delay(1000)
    

    That's all there is to it! Have fun with pygame!

提交回复
热议问题