by senocular

Mentioned earlier were the base formulas for finding a screen _x and _y for any given isometric x and y. (Remember, this is all based on a scenario where isometric (0,0) equals screen (0,0).

_x = spacing * (x + y);
_y = spacing/2 * (x - y);

Where spacing is a predefined constant representing the height of an isometric grid block (or the x movement in a single block movement as they are the same).

From these two equations we can solve for x and y to get the isometric grid position from any screen _x and _y.

x = (_x/spacing + 2*_y/spacing)/2;
y = (_x/spacing - 2*_y/spacing)/2;

Each of these functions, though seemingly simple, are the basis for all isometric behavior. What they do is convert normal grid spacing to isometric spacing and vise versa. Outside of that, all coded actions are simple, normal grid behaviors, just as you would write for normal flat grid layouts. If you haven't done that before, well I'll probably cover some of that as well.

One thing to remember here though, is that, according to my preference and how this code is set up, I am using Cartesian plane y direction which in terms of Flash means -y = y with the flipped y axis. So in converting Flash-ready grid operations to this isometric setup, that reversing will occur.



SUPPORTERS:'s fast and reliable hosting provided by Media Temple.