【发布时间】:2018-02-11 02:26:57
【问题描述】:
该栏应在 5 秒后慢慢填满,但用户应该无法在这 5 秒内点击它。我将如何同时实现这两个目标?
amount = 1
barlength = 102
while True:
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONDOWN:
(x, y) = pygame.mouse.get_pos()
if x < 200 and x > 100 and y < 200 and y > 100 and amount > 0:
currenttime = time.clock()
print (currenttime)
while time.clock() < currenttime + 5:
#untilfull = timez/barlength
pygame.draw.rect(DISPLAYSURF, (0, 0, 0), pygame.Rect(20, 20, barlength, 40))
【问题讨论】:
标签: python python-2.7 pygame