I'm making a game using Turtle, and need a throwing mechanic with a cooldown. I've tried to use the time module, but trying to classify the variables as int()
or float()
doesn't work.
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
I've tried searching on here and Google, but the only results I got were for discord.py.
Edit: I forgot to say that I did set the throwcd
variable as 2 at the start of my code.
Edit 2: There are also other things happening, like moving and enemy AI. I've tried to use things like time.sleep()
, but it stalls the entire game when I do. I haven't tried math
yet, because it seems pretty complicated.