반응형
파이 게임을 사용하기 시작했고 간단한 게임을하고 싶습니다. 필요한 요소 중 하나는 카운트 다운 타이머입니다. PyGame에서 카운트 다운 시간 (예 : 10 초)을 어떻게 할 수 있습니까?
해결 방법
start_ticks=pygame.time.get_ticks() #starter tick
while mainloop: # mainloop
seconds=(pygame.time.get_ticks()-start_ticks)/1000 #calculate how many seconds
if seconds>10: # if more than 10 seconds close the game
break
print (seconds) #print how many seconds
참조 페이지 https://stackoverflow.com/questions/30720665
반응형
'파이썬' 카테고리의 다른 글
파이썬 How to randomly select an item from a list? (0) | 2020.11.23 |
---|---|
파이썬에서 대괄호의 다른 의미 (0) | 2020.11.23 |
파이썬 Python 2.5.4-ImportError : etree.ElementTree라는 모듈이 없습니다. (0) | 2020.11.23 |
파이썬 Python으로 소리 재생 (0) | 2020.11.23 |
파이썬 Python Nose Import Error (0) | 2020.11.23 |
댓글