## Java Rectangle Collision/Move Speed Problem

So I have a deadline for a project and I have some problems with rectangle collision, and move speed of an image to a vector point. The problem with the rectangle collision is I have a little image that has a hitbox and I have it so you can draw a selection box with your mouse but the two only collide if the selection box has a positive height and width. I need it so that the selection box intersects with the hitbox no matter if its negative width/height. As long as the selection box is intersecting with the hitbox then it should count as selected. I'll post the code below, and as for the speed problem I don't know how to get something to move to a point at a constant pace and stop when it gets there.

Java Code:
```if (MouseAI.selectBox.intersects(unit.getHi
{
unit.setSelected(true);
}

if (unit.isSelected())
{
if (World.input.isMousePressed(1))
{
point.set(World.input.getMouseX() - unit.getPosition().x, World.input.getMouseY() - unit.getPosition().y);
pointSet = true;
}
}

if(pointSet)
{
float moveSpeedX = point.x * unit.getSpeed();
float moveSpeedY = point.y * unit.getSpeed();

unit.getPosition().x += moveSpeedX;
unit.getPosition().y += moveSpeedY;
}

private static int prevMouseX = World.input.getMouseX();
private static int prevMouseY = World.input.getMouseY();
public static Rectangle selectBox = new Rectangle(0, 0, 0, 0);

public static void handleAI(GameContainer gc, Graphics g)
{
if (World.input.isMouseButtonDown(0))
{
g.setColor(new Color(0, 0, 0));
selectBox.setBounds(prevMouseX, prevMouseY, World.input.getMouseX() - prevMouseX, World.input.getMouseY() - prevMouseY);
g.draw(selectBox);
}
else
{
prevMouseX = World.input.getMouseX();
prevMouseY = World.input.getMouseY();
selectBox = new Rectangle(0, 0, 0, 0);
}
}```