Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Circle walking dont know whats wrong

center = Vector(40, 34)
partner = hero.findByType("peasant")[0]

while True:
    vector = Vector.subtract(partner.pos, center) 
    moveToPos = Vector.subtract(center, vector) 
    hero.move(moveToPos)
    pass

It looks like the hero is doing exactly what its supposed to, but then it says its incomplete!

Hi! Your hero should mirror peasant movement like point (40,34) is mirror point. Instead of this he repeat moves. Try to change line of vector here:

I think Arnav_Pandey’s code is a good alternative doing the same thing as the default code and it’s working for me.
For this particular case you can even replace:

hero.move(moveToPos)
# with
hero.moveXY(moveToPos.x, moveToPos.y)

@alexbrand - I’m also not a programmer, a little bit of C, Pascal and Java once upon a time at the university. I’m only helping my son and even I don’t try completing levels that are too hard to explain to a child. You have posted some pieces of code that were inspirational for me and you are some of the few good coders that haven’t escaped codecombat and this forum.

This is strange. Your code is pretty much the same as mine…maybe a couple of different names for the variables, but still the same. I just replaced my code with yours and submitted again, successfully.

Only two things come to mind:

  1. What boots are you using? Mine are boots of leaping. Just a thought.
  2. Try in a different browser. I’m using Chrome, which seems to be very stable so far.
1 Like

Umh… I bet the line was

Vector = Vector.subtract(center, partner.pos)

when I read the post for the first time. That’s why I wrote comment to replace Vector coordinates. Because in this case the hero follows the peasant step by step right back after him.
But now code is OK, yep. It’s possible that I was wrong misreaing the code in original post O_o . Or maybe it was edited.
Thanks for kind words) I’m quite good at tactics sometimes, but awful coder. Lack of basic conceptions and understanding give me the feeling that I can wright more “winnable” and short code for multyplayer levels.

1 Like

So far @Alexbrand, you’ve not steered me wrong :slight_smile: I’ve only been playing with Python for about 10 days, so I’m not the best of coders here either.

just found out what was wrong…

I NEEDED NEW BOOTS