Wargame Map Object
Wargame Map Object
The Wargame Map Object is an easy to use, but very effective map array object. Using the basis of a hexagon map as its foundation it can create a computer controlled A* movement path from one point to another.
Programmed by Chris Branch
Do we know if this is still working for iOS? It seems to be working fine in Windows but in iOS it doesn't work and I can't even get a counter to display the map width.
My mistake. It is working. I just needed to do a full, final xCode build instead of an application build.
Originally Posted by CruddyBuddy
Another question: is there a way to change the orientation for the grid from a flat-top to a point-top hex pattern?
INSTEAD OF THIS:
Hi CruddyBuddy. As it is now, no. Maybe the author can make changes. I think it is a good request.
I think hex tiles look a lot better with a pointed top orientation because they work better with an isometric perspective. The flat top orientation has the effect of making hex tiles look elongated, so the perspective is looking straight down on them. I suppose this could be fine for really flat tiles, but if you want objects to look isometric on the tiles, I think the pointed top looks far better.
I wonder if the extension could be modified for this. There is already a function to change it from odd columns high to "even columns high", so the change would just be adding odd rows left or even rows left.
Originally Posted by nivram
I concur with your observation and I think the Author would also agree.
So I figured out how to do it, and I'm posting this solution in case anyone else needs to make their hex grid with the point-top orientation. Here is a video to show it working:
In order to make this work, you need to fool the object into thinking the game is positioned sideways, or 90 degrees, so that the object will function as if the hex tiles are flat on the top, even thought they are flat on the sides instead. To do this, when setting the tile numbers, reverse the X and Y allocations. This is how it looks in my code:
* Start of Frame
Group.HexTiles : Set Tile X to 100 - ( Y( "Group.HexTiles" ) / 192 )
Group.HexTiles : Set Tile Y to 100 - ( X( "Group.HexTiles" ) / 256 + 1 )
As you can see, I have an alterable value for X and Y for each of my tiles. But instead of setting the the Tile X number to the X position, I'm setting it to the Y position, and vice-versa. This essentially rotates the map 90 degrees in the "mind" of the Wargame Map Object.
But now we have a problem, because the tile order is in reverse, which causes the navigation mapping to go crazy because it thinks tiles are in the opposite location than they are, so when the pathway is calculated it will route the path to tiles it doesn't need to go in order to get to the destination. There is an easy fix for this, and it's actually already in the example above.
Instead of saying "Set Tile X to ( Y( "Group.HexTiles" ) / 192 )" I am actually flipping the order of the tiles as well by including "100 - " to the front of the action, so if the tile would normally be set to Tile X = 2, Tile Y = 3, it will actually be 100 - 2 and 100 - 3, or Tile X = 98, Tile Y = 97. In my video example you can see that the tile numbers start at 99 at the top left and go down from there. Remember, the object thinks the game is rotated 90 degrees, so where the map is positioned on the top left, the hex object thinks is actually rotated to the top right. You just need to make sure your Wargame Map Object is set to size 99 x 99, or larger if your map is larger. It actually doesn't matter if you have fewer than that many tiles, so long as you don't have more than the map limit you set. And for some reason, you should make the map size 1x1 smaller than the number you are using in the action, so if you have it set as "Group.HexTiles : Set Tile X to 200 - ( Y( "Group.HexTiles" ) / 192 )" then make the map size 199x199.
I hope this helps! Send me a message if you have any questions.