How can I get my player to move to the mouse when it is clicked (like in Warcraft)?
So far I have tried:
if (Mouse.isButtonDown(0)) {
if (X < Mouse.getX()) {
X += Speed;
}
if (X > Mouse.getX()) {
X -= Speed;
}
if (Y < Mouse.getY()) {
Y += Speed;
}
if (Y > Mouse.getY()) {
Y -= Speed;
}
}
But that only does what I want if I hold the mouse down.