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.

Dark GDK / My Tile Game issues

Author
Message
paulthom12345
15
Years of Service
User Offline
Joined: 11th May 2009
Location:
Posted: 12th May 2009 00:19
hi, I am trying to make a game based around tiles. I want to ask a bit of advice. Firstly is it better to keep all tiles as seperate files or as one larger tilemap?

Also, are there any tile mapping programs that you know are good and free? Im using Mappy right now.

And finally, if you think a tilemap is a better idea, then how do i split up the tiles from that tilemap in the code?

cheers
Paul
stevebrit
15
Years of Service
User Offline
Joined: 6th Jan 2009
Location: Florida USA
Posted: 12th May 2009 00:49
Hiya Paul.

Are you saying that you need some code to take a bitmap image or whatever, and split it up into individual tiles ??

If so i can help you out there, but dont wanna write the code if
thats not wot you need ...

Regards :- Steve

AMD Athlon64x2 3.1Ghz - Ram 4Gb DDR2 800Mhz - 500Gb HD
Ndivia 9600GT SLI - 24in LCD - WIN 7 - 64 bit BETA
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 12th May 2009 02:36 Edited at: 12th May 2009 02:38
You should put all your tiles in one image file. Then you have two options for displaying them:

a) You can cut the tile image up when you load it, into one image for each tile. This can be done using dbGetImage().

b) You can create one sprite for each tile, then use dbSetSpriteTextureCoord() (I think that's the name of it) to set the UV coordinates of the sprite to the coordinates of that tile.

As for a good tile-based map-maker, I use Tile Studio. It's free, open-source, and supports loads of very cool features such as tile animation, boundaries, and more.

Hope that helps.

i like orange
paulthom12345
15
Years of Service
User Offline
Joined: 11th May 2009
Location:
Posted: 12th May 2009 10:04
Yeah i was using Tile Studio for a bit, but i couldnt work out how to export the tilemap in a useful way. But if you could educate me on how to do that, that would be awesome.

Quote: "a) You can cut the tile image up when you load it, into one image for each tile. This can be done using dbGetImage().

b) You can create one sprite for each tile, then use dbSetSpriteTextureCoord() (I think that's the name of it) to set the UV coordinates of the sprite to the coordinates of that tile."


Just wonding, what is the difference between the two? I know this may be the noobiest of all noobie questions, but whats the difference? I mean does it matter if it is a sprite or an image?

Thanks for the help so far.
paulthom12345
15
Years of Service
User Offline
Joined: 11th May 2009
Location:
Posted: 12th May 2009 23:57
Oh and also, that code snippet that does cut the tilemap up would be lovely. Thanks.
stevebrit
15
Years of Service
User Offline
Joined: 6th Jan 2009
Location: Florida USA
Posted: 13th May 2009 06:30
Hi there hope this helps, short of time here so could not test code.

Regards :- Steve

AMD Athlon64x2 3.1Ghz - Ram 4Gb DDR2 800Mhz - 500Gb HD
Ndivia 9600GT SLI - 24in LCD - WIN 7 - 64 bit BETA

Attachments

Login to view attachments
stevebrit
15
Years of Service
User Offline
Joined: 6th Jan 2009
Location: Florida USA
Posted: 13th May 2009 06:39
oooops silly me i always do this when in a rush...

the line containing variable 'imagechrtileset' alter to line below

dbLoadBitmap( "c:/media/tileset.png" , 10 );

did not have time to finish totally with it but noticed that problem...

oh and your media of course will be in a different location

regards :- Steve

AMD Athlon64x2 3.1Ghz - Ram 4Gb DDR2 800Mhz - 500Gb HD
Ndivia 9600GT SLI - 24in LCD - WIN 7 - 64 bit BETA
stevebrit
15
Years of Service
User Offline
Joined: 6th Jan 2009
Location: Florida USA
Posted: 13th May 2009 22:13
OK i have made a better version and have added a tileset image
for you to use, feel free to use the code if you make a million bucks using it i would appreciate a few bucks lol....

The demo code loads the image in displays the tiles off it and then colors them randomly ???

Regards :- Steve

AMD Athlon64x2 3.1Ghz - Ram 4Gb DDR2 800Mhz - 500Gb HD
Ndivia 9600GT SLI - 24in LCD - WIN 7 - 64 bit BETA

Attachments

Login to view attachments
stevebrit
15
Years of Service
User Offline
Joined: 6th Jan 2009
Location: Florida USA
Posted: 14th May 2009 00:05
sorry for double posting BUT i forgot to add function to delete media.... SORRY

void deletemedia( int mediamaxID ) // delete media from memory
{
int counter;

for ( int counter = 0; counter <= mediamaxID; counter ++ )
{
if ( dbSpriteExist( counter ) ) dbDeleteSprite( counter );
if ( dbBitmapExist( counter ) ) dbDeleteBitmap( counter );
if ( dbImageExist( counter ) ) dbDeleteImage( counter );
if ( dbMusicExist( counter ) ) dbDeleteMusic( counter );
}
}

use this function to delete media i'll leave you to figure it all out..............

Regards :- Steve

AMD Athlon64x2 3.1Ghz - Ram 4Gb DDR2 800Mhz - 500Gb HD
Ndivia 9600GT SLI - 24in LCD - WIN 7 - 64 bit BETA
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 14th May 2009 03:11
To avoid double posting, you can click the edit button on one of your previous posts to edit the message.

#ifdef _DEBUG
FixBugs(All);
#endif

Login to post a reply

Server time is: 2024-11-05 18:42:26
Your offset time is: 2024-11-05 18:42:26