Right, so in my Player class where I call the object I got an if statement which gets the coordinates for the mouse
bool PickedCoords = true;
MouseState mouseState = Mouse.GetState();
if (newState.LeftButton == ButtonState.Pressed && oldState.LeftButton == ButtonState.Released)
{
PickedCoords = true;
int MouseX = mouseState.X;
int MouseY = mouseState.Y;
}
else
{
PickedCoords = false;
}
oldState = newState; // this reassigns the old state so that it is ready for next time
Now how would I make MouseX and MouseY be used as the direction of the vector of my object moving in the specified X and Y coordinates? What I'm, almost trying to do is move the object in the direction of the mouse click and make it continue to move in that direction until it's stopped by whatever.
Vector2.Normalize()
, it's a method that allows you to calculate the distance between 2 vector locations, and with that you can also calculate how to move in the direction of that vector as well. \$\endgroup\$