So i have 2 players on screen and a player send a attack, what i want is that

if x,y are different of x,y destPos move only diagonal towards the destination position.

if just x is different well move x only, same with y.

I know i have to some how decrease the shorter movement but have no idea of the equation.

Ima leave some photo to explain better since my english is bad.

here is my actual code.

```
Vector2 destPos = atacando_a.getPosition();
boolean hasToMoveRight = destPos.x > pos.x;
boolean hasToMoveLeft = destPos.x < pos.x;
boolean hasToMoveUp = destPos.y > pos.y;
boolean hasToMoveDown = destPos.y < pos.y;
if(hasToMoveRight)
pos.x += speed;
if(hasToMoveLeft)
pos.x -= speed;
if(hasToMoveUp)
pos.y += speed;
if(hasToMoveDown)
pos.y -= speed;
```

Thank you!