# How to make a pulling mouse constraint?

**URL:** <https://discourse.processing.org/t/how-to-make-a-pulling-mouse-constraint/21200>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [May 23, 2020, 5:26am UTC](https://discourse.processing.org/t/how-to-make-a-pulling-mouse-constraint/21200 "2020-05-23T05:26:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nis](https://avatars.discourse-cdn.com/v4/letter/n/3ab097/32.png) [@Nis](https://discourse.processing.org/u/Nis)\
**Post date:** [May 23, 2020, 5:26am UTC](https://discourse.processing.org/t/how-to-make-a-pulling-mouse-constraint/21200/1 "2020-05-23T05:26:31Z")

</div>

[https://editor.p5js.org/Nis\_Collect/sketches/U0p3GjOK1](https://editor.p5js.org/Nis_Collect/sketches/U0p3GjOK1)

Above is the link of my code.  
Please check it and please let me know how can I make my player get pulled towards an enemy (like Spiderman is attracted with some speed to something after sticking it’s web), if I click on any of the enemies(red coloured picture).  
Please explain briefly with some code also.  
Please…Please…Please tell me

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 24, 2020, 5:06am UTC](https://discourse.processing.org/t/how-to-make-a-pulling-mouse-constraint/21200/2 "2020-05-24T05:06:36Z")

</div>

> [@Nis](#):
>
> my player get pulled towards an enemy

check out lerp

> **[reference | p5.js](https://p5js.org/reference/#/p5.Vector/lerp)**
>
> p5.js a JS client-side library for creating graphic and interactive experiences, based on the core principles of Processing.
