Original Post
Hello,
I am in the process of developing a strategy game which uses a map array and 2D tiles as the playing board. I have an array as follows.
dim array(x,y,z) where X is the X and Y is the Y. Z is the data I want to store for each cell.
For a map that is x=5 and y=5. 0,0 would be the top left corner and 4,4 would be the bottom right.
I know there is most likely a math formula to calculate this but I have not figure it out yet: How do you calculate the # of cells from 1 cell to another with the following assumptions.
#1 Any cell can be travelled over.
#2 Any direction is ok.
So an army going from 0,0 to 4,4 would travel over 1,1 --> 2,2 --> 3,3 --> 4,4 This should come out as 4 Cells travelled.
Thanks,
Stormfury