How to make a pulling mouse constraint?

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

check out lerp

1 Like