# Dance Off Help Needed

**URL:** <https://discourse.codecombat.com/t/dance-off-help-needed/11085>\
**Category:** Bugs\
**Created:** [April 3, 2017, 11:38pm UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085 "2017-04-03T23:38:01Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_TD\_RodYT](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/_td_rodyt/32/6285_2.png) [@\_TD\_RodYT](https://discourse.codecombat.com/u/_TD_RodYT)\
**Post date:** [April 3, 2017, 11:38pm UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085/1 "2017-04-03T23:38:01Z")

</div>

My code seems correct and I even followed the video tutorial but my hero just stands there.  
@Serg @Bryukh @nick

```python
while(true) {
    var friend = hero.findNearest(hero.findFriends());
    var offsetX = friend.pos.x - hero.pos.x;
    var offsetY = friend.pos.y - hero.pos.y;

    hero.move({x: friend.pos.x - offsetX, y: friend.pos.y - offsetY});
}

```

---

<div class="post-metadata">

**Author:** ![Hellenar](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/hellenar/32/9100_2.png) [@Hellenar](https://discourse.codecombat.com/u/Hellenar)\
**Post date:** [April 3, 2017, 11:43pm UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085/2 "2017-04-03T23:43:48Z")

</div>

Maybe use `"x"` and `"y"` instead of just `x` and `y`?

---

<div class="post-metadata">

**Author:** ![\_TD\_RodYT](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/_td_rodyt/32/6285_2.png) [@\_TD\_RodYT](https://discourse.codecombat.com/u/_TD_RodYT)\
**Post date:** [April 3, 2017, 11:44pm UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085/3 "2017-04-03T23:44:54Z")

</div>

I don’t know, hero just stands there. All of the other people who solved this had identical code to me so I don’t get why mines wouldn’t work.

---

<div class="post-metadata">

**Author:** ![\_TD\_RodYT](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/_td_rodyt/32/6285_2.png) [@\_TD\_RodYT](https://discourse.codecombat.com/u/_TD_RodYT)\
**Post date:** [April 3, 2017, 11:45pm UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085/4 "2017-04-03T23:45:30Z")

</div>

Tried it, didn’t work

---

<div class="post-metadata">

**Author:** ![Hellenar](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/hellenar/32/9100_2.png) [@Hellenar](https://discourse.codecombat.com/u/Hellenar)\
**Post date:** [April 3, 2017, 11:45pm UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085/5 "2017-04-03T23:45:35Z")

</div>

Also do you have boots with `move` ability?

---

<div class="post-metadata">

**Author:** ![\_TD\_RodYT](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/_td_rodyt/32/6285_2.png) [@\_TD\_RodYT](https://discourse.codecombat.com/u/_TD_RodYT)\
**Post date:** [April 3, 2017, 11:46pm UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085/6 "2017-04-03T23:46:52Z")

</div>

I have the Fine Boots and Boots of Leaping. Neither will work

---

<div class="post-metadata">

**Author:** ![Hellenar](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/hellenar/32/9100_2.png) [@Hellenar](https://discourse.codecombat.com/u/Hellenar)\
**Post date:** [April 3, 2017, 11:47pm UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085/7 "2017-04-03T23:47:31Z")

</div>

Seems like a bug. Maybe contact @serg or @Bryukh or somebody.

---

<div class="post-metadata">

**Author:** ![Hellenar](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/hellenar/32/9100_2.png) [@Hellenar](https://discourse.codecombat.com/u/Hellenar)\
**Post date:** [April 3, 2017, 11:47pm UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085/8 "2017-04-03T23:47:54Z")

</div>

Fine boots do not have `move`.  
Updated: Oops, they do. I was thinking of the softened leather boots 😂

---

<div class="post-metadata">

**Author:** ![\_TD\_RodYT](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/_td_rodyt/32/6285_2.png) [@\_TD\_RodYT](https://discourse.codecombat.com/u/_TD_RodYT)\
**Post date:** [April 3, 2017, 11:53pm UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085/9 "2017-04-03T23:53:35Z")

</div>

I sent an invite to them

---

<div class="post-metadata">

**Author:** ![Hellenar](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/hellenar/32/9100_2.png) [@Hellenar](https://discourse.codecombat.com/u/Hellenar)\
**Post date:** [April 3, 2017, 11:54pm UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085/10 "2017-04-03T23:54:52Z")

</div>

Great! 👍

(Post must be at least 20 characters.)

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [April 5, 2017, 6:12am UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085/11 "2017-04-05T06:12:01Z")

</div>

Your code has one mistake (two technically). Try to “debug” it in your mind. What is happening in each cycle? You find `offsets` and move your hero to the friend’s position plus offset, but what the new position is? Yes, it’s your hero position. I suppose you can find the answer already, however, if it’s not enough, say me and I will add a hint 😉

---

<div class="post-metadata">

**Author:** ![\_TD\_RodYT](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/_td_rodyt/32/6285_2.png) [@\_TD\_RodYT](https://discourse.codecombat.com/u/_TD_RodYT)\
**Post date:** [April 9, 2017, 4:39am UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085/12 "2017-04-09T04:39:26Z")

</div>

I’m still confused because in the while loop, every new cycle, offset will be redefined as the friends NEW pos.x - hero.pos.x

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [April 9, 2017, 5:22am UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085/13 "2017-04-09T05:22:54Z")

</div>

Yes, so you don’t need to redefine it. You need the initial offset (at the 1st frame) then use only it.

---

<div class="post-metadata">

**Author:** ![\_TD\_RodYT](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/_td_rodyt/32/6285_2.png) [@\_TD\_RodYT](https://discourse.codecombat.com/u/_TD_RodYT)\
**Post date:** [April 10, 2017, 5:53am UTC](https://discourse.codecombat.com/t/dance-off-help-needed/11085/14 "2017-04-10T05:53:20Z")

</div>

Thank You, that solves it. I put the friends and offsets outside of the while loop and it worked.
