aspose file tools
The moose likes Java Micro Edition and the fly likes Mapping a hex game board to rectangular tiles. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Reply Bookmark "Mapping a hex game board to rectangular tiles." Watch "Mapping a hex game board to rectangular tiles." New topic
Author

Mapping a hex game board to rectangular tiles.

Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 609
I was pleased to read about the Game APIs support of tiled screens, but I'm still stuck trying to figure out an efficient way to create a hexagon based map using rectangular tiles.
I started to explain a lot of the details, but for now I think just being able to make the map would be a good start.
Basically there's two types of hexes on the map. However, there's an added complication that any or all of the six sides of the hex could allow any game piece to cross or restrict crossing to specified types of pieces.
If anyone here's got experience with this kind of issue, or can point me in a reasonable direction, I'd be most grateful.
Thaks!


SCJP, SCJD, SCEA 5 "The only rules that really matter are these: what a man can do and what a man can't do." Captain Jack Sparrow
Burk Hufnagel
Ranch Hand

Joined: Oct 01, 2001
Posts: 609
Hmm... Nobody's replied which leads me to believe its either much simpler than I suspect, much harder, or nobody cares...
Guess I'd better try someplace like Gamasutra...
John Hembree
hired gun
Ranch Hand

Joined: Mar 07, 2003
Posts: 250
Sorry Burk, I've read your post but have no clue what to tell you. It's hard to tell how many people look at your post and then like myself don't have a clue. I actually came back in here when I saw that it had a reply to see what the answer might have been.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12271
    
    1
It was quite a while ago and in a different environment but here is what I did.
The map was represented by multiple 2D arrays.
One array had "connectivity type code" for each location - this code controlled the allowable "movement" from that location in terms of the changes in x (rows) and y(columns) that were possible.
In other words, taking location x1,y1 the connectivity code led to all the legal changes in x and y - similiar to a terrain map really.
For display, each row has an offset that lets you display the row so it looks like a hex map.
(lets see if I can show this...)

So x1y1 is a type that can move +1x or +1y
x2y2 can move in six directions, etc.
Bill


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mapping a hex game board to rectangular tiles.
 
Similar Threads
Firefox or Opera
Struts Tiles without Struts?
Need help with centering screen
What should a 2d tile-based map basically have???
Developing Games in Java does anyone know if this book is any good?