# Sir Robin Bravely Ran Away - looked for a more elegant answer and received a class in using Vector

**URL:** <https://discourse.codecombat.com/t/sir-robin-bravely-ran-away-looked-for-a-more-elegant-answer-and-received-a-class-in-using-vector/5140>\
**Category:** Adventurer\
**Created:** [October 5, 2015, 2:14pm UTC](https://discourse.codecombat.com/t/sir-robin-bravely-ran-away-looked-for-a-more-elegant-answer-and-received-a-class-in-using-vector/5140 "2015-10-05T14:14:18Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![NoJuice](https://avatars.discourse-cdn.com/v4/letter/n/54ee81/32.png) [@NoJuice](https://discourse.codecombat.com/u/NoJuice)\
**Post date:** [October 5, 2015, 2:20pm UTC](https://discourse.codecombat.com/t/sir-robin-bravely-ran-away-looked-for-a-more-elegant-answer-and-received-a-class-in-using-vector/5140/2 "2015-10-05T14:20:30Z")

</div>

CTRL + K:

```
   This has been CTRL+K'd
TEST
    if (fNearestThreat !== null) distance = friends[0].distanceTo(fNearestThreat);

    for(var allyCaptureJobIndex in friends)
    {
        var friend = friends[allyCaptureJobIndex];
        var targetPos = points[quadrant].pos;
        var escapeVector = this.getEscapeVector(friend.pos, targetPos, dangerZones, 25, 0);
        
        if(escapeVector === false)
```

---

_[View the full topic](https://discourse.codecombat.com/t/sir-robin-bravely-ran-away-looked-for-a-more-elegant-answer-and-received-a-class-in-using-vector/5140)._
