Here’s what I am trying to do. I am not strong enough to last in one of timed survival parts, so I am trying to set up flags and keep jumping from one area to another. In essence totally avoiding most if not all enemies.
It is possible to do this?
flag = self.findFlag()
enemy = self.findNearest(self.findEnemies())
loop:
enemy = self.findNearest(self.findEnemies())
if flag:
"x" = flag.pos.x
"y" = flag.pos.y
self.jumpTo({"x":, "y":})
else:
if enemy:
self.attack(enemy)
self.attack(enemy)
Obviously, I not certain how to set up the JumpTo, or even if it possible.
This is how I would do it. You want to check if jump is ready and move if not, you can just jump straight to flag.pos, you want to pick up the flag if you’re close enough, and you want to only take one action per loop (so only one attack instead of two). Also make sure to assign flag and enemy variables within the loop, or they’ll never update.
loop:
flag = self.findFlag()
enemy = self.findNearest(self.findEnemies())
if flag:
if self.isReady("jump"):
self.jumpTo(flag.pos)
else:
self.move(flag.pos)
if self.distanceTo(flag) < 5:
self.pickUpFlag(flag)
elif enemy:
self.attack(enemy)