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 :
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;
}