我是pygame的新手,我正在尝试创建一个函数,首先从图像1翻转到图像2(现在可以正常工作),然后在一段时间后自动翻转。代码将运行但不会返回到图像1。有小费吗?
def toggle_card(x, y):
card_state = get_card_state(x, y)
if card_state == CARD_UP:
set_card_down(x, y)
else:
set_card_up(x, y)
def auto_toggle(x,y):
if card_state == CARD_UP:
set_card_down(x,y)
while set_card_down(x,y):
pygame.time.delay(2000)
set_card_up(x,y)
return time