So I’m attempting to make custom functions for Wakka Maul Arena and I’ve noticed that whenever I run them, they kind of zip through and then to the next method. In this case, I’ve made a function for reducing the number of lines needed to move around, but when I use it, it goes through it and then instantly starts trying to attack something that’s not in range yet.
def multiMove(steps, movements = []):
for x in range(steps):
counter = 0
if movements.index(counter) == u:
hero.moveUp()
elif movements.index(counter) == d:
hero.moveDown()
elif movements.index(counter) == l:
hero.moveLeft()
elif movements.index(counter) == r:
hero.moveRight()
else:
break
counter += 1
multiMove(2, [u, l])
hero.attack("enemy")
I’ve tried using the time library but it doesn’t appear to be implemented. I’ve looked online and the only thing I could find that might work would be a callback function, but I don’t really understand them and how to implement in python(codecombat).