Talking about Hexagonal Tiles game, Actionscript 2, Flash and Game development.
In the Finding adjacent cells in an hex map post I showed you how to find adjacent cells in horizontal hex maps.
Now it’s time to find adjacent cells in vertical hex maps.
hexagon_width = 44;
hexagon_height = 38;
grid_x_size = 10;
grid_y_size = 12;
sector_width = hexagon_width/4*3;
sector_height = hexagon_height;
gradient = (hexagon_width/4)/(hexagon_height/2);
for (x=0; x=hexagon_height/2) {
if (delta_sector_x>(hexagon_width/2-delta_sector_y*gradient)) {
real_x = sector_x;
real_y = sector_y;
}
else {
real_x = sector_x-1;
real_y = sector_y;
}
}
else {
if (delta_sector_x=0) and (real_x=0) and (real_y
Here it is:
This is the last uncommented step, during next one we will discuss about the method used to determine adjacent cells.
Download and enjoy!!
Never miss an update! Subscribe, and I will bother you by email only when a new game or full source code comes out.