【发布时间】:2017-06-21 09:42:27
【问题描述】:
我是 python 新手,我正在尝试制作一个控制台游戏。为了检测按键,我使用了 getch (https://github.com/joeyespo/py-getch)。但是当我按下 a 时,代码开始重复。
key = getch()
while (True):
if (key == 'a'):
principal.adicionaragua()
principal.gastaragua()
principal.aumentardias()
principal.estado()
time.sleep(2)
clear()
编辑:我使用的是 windows 和 python 2.7
【问题讨论】: