**this**-object) to the specified coordinate, that uses integers to calculate this instead of decimals.

I have tested multiple algorithm found on the net. They all work the same and look identical ingame even if their implementation differs.

The problem is, since my game use integers as coordinates and not float, which the method found on the net use, the movespeed is not always the same. I mean, sometimes, the unit "walk" the specified speed, and sometimes it walks that specified movespeed + 1, which is unacceptable(I might sound picky, but it is noticeably ingame and can have major effect on gameplay).

I tried some things like casting and rounding but they are not helping. Here is the method.

public void moveToward(int targetX, int targetY, int steps) //TODO: { if(posX == targetX && posY == targetY) return; int fX = targetX - posX; int fY = targetY - posY; double dist = Math.sqrt( fX*fX + fY*fY ); double step = (steps / dist); posX += fX * step; posY += fY * step; }