# Slow Movement of player to mouse position on mouse click

**URL:** <https://discourse.processing.org/t/slow-movement-of-player-to-mouse-position-on-mouse-click/26844>\
**Category:** Coding Questions\
**Created:** [January 6, 2021, 7:06pm UTC](https://discourse.processing.org/t/slow-movement-of-player-to-mouse-position-on-mouse-click/26844 "2021-01-06T19:06:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [January 6, 2021, 7:21pm UTC](https://discourse.processing.org/t/slow-movement-of-player-to-mouse-position-on-mouse-click/26844/2 "2021-01-06T19:21:55Z")

</div>

Hey, welcome to the forum!

Great to have you here!

Your Sketch is good!

The “if” is not really necessary.

Also, in my version you can click the mouse to start the player.

Warm regards,

Chrisir

**here is my version :**

```auto
float plposX;
float plposY;

float mouseXDesired, mouseYDesired; 

float easing = 0.05;

void setup() {
  //fullScreen();
  size(600, 600);
  plposX = width/2;
  plposY = height/2;
  mouseXDesired=plposX;
  mouseYDesired=plposY; 

  cursor(CROSS);
}

void draw() {
  background(0);

  //direction line
  strokeWeight(5);
  stroke(255, 255, 255, 100);
  line(plposX, plposY, mouseXDesired, mouseYDesired);

  //player display
  fill(255);
  noStroke();
  ellipse(plposX, plposY, 40, 40);

  //player movement
  plposX+= (mouseXDesired-plposX)*easing;
  plposY+= (mouseYDesired-plposY)*easing;
}

void mousePressed() {
  mouseXDesired=mouseX;
  mouseYDesired=mouseY;
}

```

---

_[View the full topic](https://discourse.processing.org/t/slow-movement-of-player-to-mouse-position-on-mouse-click/26844)._
