[SOLVED] Chain of command: moveXY not working properly

In Chain of command, my hero doesn’t move to the coordinates I am specifying in the code, but lower:
The lower red cross is at (30,15), so:

    # Move to the X in the camp.
        hero.moveXY(30, 33)
        # Then return to the X outside the camp.
        hero.moveXY(30, 15)

However, for some reason, hero keeps standing well below y == 15, it’s more like y == 12!

chainofcommand

As a result, he’s slow to get out of the way of wizard’s flame attack and gets hit each time > dies before the last wave of enemies.
He behaves the same (stands in the same point) if I use y == 12, but stand above the cross if I use y == 18 !
Please don’t answer with “use a faster hero/faster boots”. The problem shouldn’t be his speed, but that he’s standing in the wrong place.

1 Like

Nothing wrong with moveXY. Passed with your code perfectly with Tharin and speed of ring. Change the hero, tweak a little bit the coordinates and it will work.

1 Like

Any idea why this hero won’t stand on the coordinates I specified? After all, the instructions do say:“return to the X outside the camp” - coordinates: (30,15)
Also:

1 Like

The points are right . See https://codecombat.com/editor/level/chain-of-command
In some terrains there is some slipping. I don’t have an clear understanding how much this slipping is and a definitive algorithm to fight it.
but in you case a possible solution is:

        hero.moveXY(30, 30);
        hero.moveXY(30, 33);
        // Then return to the X outside the camp.
        hero.moveXY(30, 18);
        hero.moveXY(30, 15);
2 Likes

I’ve been guilty for two years for not giving the correct answer - “the definitive algorithm to fight slipping”:

if enemy:
    # code here
else:
    hero.move(hero.pos)

:slight_smile:

2 Likes

lol…does this mean that you’ve just xythonized yourself?

2 Likes