Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Creating a hex game board

Author
Message
Kingspud
18
Years of Service
User Offline
Joined: 6th Jan 2006
Location:
Posted: 6th Jan 2006 18:57
Hello all,

Does anyone know how to create a hex game board?
I would like to create a game that uses different size hex boards and can't seem to find any code.
Once I have the hex board then made some help on whether it would be easier to create gif or bmp image files for the hexes in the game board?
Thanks for any help!
kingspud
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 6th Jan 2006 22:50
You can just make one in a drawing program and load that into your program. Keep away from .gif (won't load) and .jpg (bad color). Use .png (transparencies) or .bmp (flawless big files).


Kingspud
18
Years of Service
User Offline
Joined: 6th Jan 2006
Location:
Posted: 6th Jan 2006 22:59
I can see how that would work with a single large image but what if I want to use separate hexes? The image is going to want to set as a square and not a hex??!?!?
How do I get the 6 sides to work instead of 4?
Thanks
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 8th Jan 2006 00:07
unless you come up with a fancy routine, i don't think you'll get away from the 'square' images. but, you can make a tileable square image with the hex result using some basic copy and paste functions and a little thought.

consider the attached 'square'/tile. the dimensions on it are not perfect so don't use this as your master; you'll have to do some experimenting that i'm not willing to do right now, but you get the idea. if something like this was your basic 'tile', you could copy the right parts as squares with the hex result you're looking for. you will notice that it is comprised of 3 complete hexes, re-arranged to form a square. there are many possible ways that i can think of to work with this idea, and i'm confident that you'll be able to find an easy-enough way to achieve your desired results. hope this helps get you on track. it may not be the best way, but being such a novice programmer myself, i tend to approach things in a very simplistic manner.

My Modest System:
Athlon XP1800+, Windows XP+SP2, Soyo K7V Dragon+ MB, 1.5Gb 333 RAM, ATI Radeon 8700LT (128Mb), Drivers and Updates Kept Current

Attachments

Login to view attachments
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 8th Jan 2006 00:29
Have fun

Why make sense when you could make brownies?
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 8th Jan 2006 04:32 Edited at: 8th Jan 2006 04:34
Quote: "I can see how that would work with a single large image but what if I want to use separate hexes? The image is going to want to set as a square and not a hex??!?!?
How do I get the 6 sides to work instead of 4?
Thanks"


Because Darkbasic considers black as transparent by default you just need a single hex that has black at the edges. Then make a routine to switch the starting y coordinate at every other column.

I didn't put "sync on" in this code snip to show what it's doing.


Edit: The image used is attached to this message.


Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-27 07:46:28
Your offset time is: 2024-11-27 07:46:28