Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I want to create a Windows Form-based adventure game where the player clicks a hex on a static map to bring up their next encounter. I have the map already and plan to scan it and convert it to a .bmp file. My problem is that I'm not sure how to tie the map image in with the game code. Unless I'm mistaken, I think I need to use some kind of imagemap control. If that's the case, do I need to plot each hex individually, or is there a way to plot the whole map in bulk? I found this article, but I'm not sure if it's relevant to what I want to do or not. I'm just looking for general information or links to relevant articles. Thanks.

share|improve this question
    
I think that link you posted explains everything quite nicely. With the math explained there, you should be able to figure out on which hexagon the user clicked on your map. Drawing the individual tiles might give you more flexibility than using a huge scanned image. Just think about cases where you need to swap a tile graphic? –  bummzack Aug 7 '10 at 8:02
    
I forgot to mention that the map already has a hex grid on it. It's really just a small map - only about 25 x 10 hexes, and it has hand-drawn terrain, place names, etc. Not sure if that changes anything or not. –  Raven13 Aug 7 '10 at 15:04

1 Answer 1

up vote 11 down vote accepted

I really like Amit's Game Programming Information, and it has a whole section on hexagon grids. Perhaps you'd find any of those links to be informative?

Here is the list of links he gives:

I apologize if this isn't helpful. Windows Form isn't the ideal platform to develop a game, but I assume you would have one image per grid square and give it an OnClick event. There would be the issue of overlapping corners though... (the transparent corners of the square image that the grid image is on). In a traditional game you would use the above information to figure out how to translate click coordinates (screen space) to the hexagonal grid coordinates (which your link details nicely), and then handle it appropriately.

share|improve this answer
    
That site was invaluable to me when I was implementing a hex grid in C#/WPF. Lots of good info there. –  Mike Strobel Aug 9 '10 at 18:52
    
Wow, Amit is still going! I used that 10+ years ago to learn A* in school. –  tenpn Aug 10 '10 at 8:31
    
+1 for a blast from the past. I remember looking at those tutorials back in the late 90s. Great link! –  Larry Smithmier Aug 14 '10 at 20:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.