JumpTo a flag question


#1

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.

I appreciate any help.


#2

you got the right idea:

if isReady("jump"):
    self.jumpTo({"x": x, "y": y})
else
    self.moveXY(x,y)  # move({"x": x, "y": y}) would only take one step

I’m not sure what happens if jump is not ready? nothing until ready? or nothing? (most actions when not ready do the first)


#3

I am fond of your strategy .My armor is so weak that I am unable to survive in this part.Maybe I should try to move to avoid fighting


#4

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)

#5

Thank you. The code worked well, but I don’t think jumping is going to solve the issue for me. I still died. Oh well back to the drawing board.