How to 'jumpTo' with Boots of Leaping?


#1

How do I use flag.pos.x and flag.pos.y with the Boots of leaping and ‘jumpTo’ to the desired location?


#2

The hero.jumpTo method expects a Vector or Vector-compatible object (e.g. a dict containing x and y properties) as argument.

Luckily, units’ pos property is already a Vector object, so you can do:

hero.jumpTo(enemy.pos)

In case you want to use arbitrary coordinates, you can use:

hero.jumpTo({ 'x': 10, 'y': 20 })
# Or:
hero.jumpTo(Vector(10, 20))

#3

Hi,

If the flag is declared as flag = hero.findFlag()

So, can I use - hero.jumpTo(flag.pos)?


#4

Yup, that should work. Make sure to use an if flag: and it should be fine.