# Isometric Game World Boundaries Equation

I ran into a problem last night and I can't solve it since. I'm making an isometric game based on tiles with equal rows and columns. Now I made moving entities which should turn whenever they reach the boundaries of the world. As I illustrated on the picture they are turning back on the upper boundaries (green) , but not on the lower ones (red). I tried various equations on the lower part, but i cannot figure out for the life of me what is the lower parts code. What would be an appropriate solution for the shrinking lines?

boolean checkBounds(){ float absX = Math.abs(getX()); float absY = Math.abs(getY()); if(absY*2-absX<0 || ??? ) return false else return true; } • Usually an isometric game will use the diamond layout exclusively for display. All world & gameplay logic is done in a separate coordinate system, with the axes aligned to the rows & columns (so eg. (2, 0) is the third column of the first row, assuming 0-based indices), and transformed to the isometric perspective only for the drawing step. This kind of switch will likely make a lot of your logic much simpler. – DMGregory Feb 23 '19 at 18:34

This way your transition between (unoccupied) tiles becomes a simple fractional value, for example, xFractionToNextCell == 0.4 means you're 40% of the way on your movement to the next tile, in x. You can do the same for y. Once it hits 1.0 AND you are at the edge of the map, you can turn.