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 / How do i draw a hex grid ?

Author
Message
Lryd
20
Years of Service
User Offline
Joined: 6th Mar 2004
Location:
Posted: 22nd Feb 2005 15:06
Hi!

im pretty new to Darkbasic pro, and im thinking of making a 2d war board game, but i have run into problems.

my first question is:
1) Shall i use a bitmap image as board ? or is it better to use a tile map maker software to make the board ?

2) How do i draw the hex grids over the map ? please can some one show me how to do ? i know i maybe asking to much, but it would be greatly appreciated if you can show me how to make an hex grid over an image, and how to move sprites inside them. It would be an great start, for me!

Thx guys
Emperor Baal
20
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 22nd Feb 2005 17:20
1) use a tile map, not a big bitmap! It will probably rise above 100mb when you want a big map. So you'll probably want to look at 2)

2) Well, assuming you want a tile map, you can try this:

Make several tiles:



Now you need to load them:
load image "tile1.jpg", 1
load image "tile2.jpg", 2

Then make an array that will hold the map info:
dim hexmap(500,500)

Here's an example of the map:


The lowest tile is tile X0,Y0

Now you will need a map routine:


Now call this function when you've filled the array, like:
hexmap(0,0)=1
hexmap(1,0)=1
hexmap(0,1)=1
hexmap(1,1)=2

Camera_x and camera_y are the "camera" positions within the map, this way you can scroll the map.


so it could look like this:


Lryd
20
Years of Service
User Offline
Joined: 6th Mar 2004
Location:
Posted: 22nd Feb 2005 21:58
Thanks this is awesome!
very nice!

Now i just have to figure out how to put sprites so i actually
can move units inside...

thx alot for the help!
Lryd
20
Years of Service
User Offline
Joined: 6th Mar 2004
Location:
Posted: 27th Feb 2005 23:44
Thx!

I was wondering, can i use any software to create a map ?
instead of doing it by cordinate inside my head ?

second question is, let say i find a software to make a tile map
how do i load the map ?

Third Question is, should i use sprites or just image pictures as units then they walk around on the map ? this shall be an turnbased strategy game so i dont need so difficult gfx. And i you guys thinks its best to use sprites, how do i make them move inside the map ? and how can i make let say i make a tank it should be able to move 2 squares, and infanteri just 1 square how can i make that happen ? plz help me! thanks!

Ohh i forgot, something are there any good 2d strategy tutorials out there who isent for Rts ? just Turnbased ?

thx alot guys!

Login to post a reply

Server time is: 2024-11-27 23:35:13
Your offset time is: 2024-11-27 23:35:13