Python clock.schedule_interval()在pygame中有效还是仅在pygame zero中有效?
我正在遵循一个涉及pygame zero的教程,并对其进行调整以创建pygame程序,但我的计时器有问题。time_left变量在前面设置为10,下面是与计时器相关的其余代码:Python clock.schedule_interval()在pygame中有效还是仅在pygame zero中有效?,python,python-3.x,pygame,pgzero,Python,Python 3.x,Pygame,Pgzero,我正在遵循一个涉及pygame zero的教程,并对其进行调整以创建pygame程序,但我的计时器有问题。time_left变量在前面设置为10,下面是与计时器相关的其余代码: def update_time_left(): global time_left if time_left: time_left = time_left - 1 else: game_over() clock.schedule_interval(upda
def update_time_left():
global time_left
if time_left:
time_left = time_left - 1
else:
game_over()
clock.schedule_interval(update_time_left, 1.0)
在pygame中,clock.schedule\u interval()部分可以工作吗?如果没有,还有什么我可以用的吗?
schedule\u interval
在pygame中不存在。见模块<代码>调度时间间隔这是pygame zero中类时钟
的一种方法。看
在pygame中,您可以创建计时器事件。请参阅问题或答案