我正在用乌龟做游戏,需要一个有冷却时间的投掷机械师。我尝试使用时间模块,但是尝试将变量分类为int()
或float()
是行不通的
def throw(throwcdstart,throwcd):
if throwcd >= 2:
throwcdstart = int(time.time())
print('Thrown!') #this is put here as a placeholder
throwcd = int(time.time()) - throwcdstart #this part is in a while true at the bottom, by the way
我试着在这里和谷歌上搜索,但我得到的唯一结果是discord.py
编辑:我忘了说我在代码的开头将throwcd
变量设置为2
编辑2:还有其他事情发生,比如移动和敌人AI。我尝试过使用time.sleep()
之类的东西,但当我这么做的时候,它会使整个游戏陷入停顿。我还没有试过math
,因为它看起来很复杂
非常厚颜无耻的表述,因为问题被问得非常不明确:
相关问题 更多 >
编程相关推荐