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 / File Loading

Author
Message
Blobby 101
18
Years of Service
User Offline
Joined: 17th Jun 2006
Location: England, UK
Posted: 18th Nov 2007 21:30
ok, i've got someone making 2d levels for a game - they are making them out of tiles - so you would have a level like:
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00#
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00#
00,00,00,00,00,00,01,01,01,01,01,01,01,01,01,01,01,01,01,01#
00,00,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00#
00,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00#
00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00#
00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00#
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00#
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00#
01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,00,00#
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00#
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,01#
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,00,00#
00,02,00,00,00,00,00,00,00,00,00,00,00,00,00,00,01,00,00,00#
01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01,01#

01 is a tile, 02 is player start position and 00 is transparent. the # sign is the end of the line.
i've loaded it up to read but how would i get dbpro the put the right image in that place? all the maps are the same width and height so it doesn't need positions.
does anyone have any ideas? i really need these to load right.
thanks.


thanks to deathead for the sig! please Click on it!
vorconan
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 18th Nov 2007 23:27
It should just be a case of:



But I may of read your question wrong, hope it helps though.



LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 19th Nov 2007 00:23
I agree with vorconan's idea of using an array to store the values of the images you wish to display. However, I would load all of the images separately, and then have your program simply paste the images in place.
Slightly altered version of vorconan's example:


Since you are using the image numbers themselves in your grid, you can simply use it to tell which image to paste. This assumes images that are 40 X 40 pixels.

Hope this helps,

LB
Blobby 101
18
Years of Service
User Offline
Joined: 17th Jun 2006
Location: England, UK
Posted: 19th Nov 2007 21:32
i'm being stupid, i know but how would i get that working? there is the background image being pasted in the background, there is a transparent image to take up the spaces where there are no tiles and there is the tile image. i've got the data i posted in my first post up there. this is a code with the type of image to go in each place. on it's own this does not do anything. i could use this to place the tiles but i need it so that DBpro can. i'm not sure if you completely understood me last time. because you use the read command in there which i thought was to do with data statements and all that. it doen't need anything else, just a way of loading the file (open to read) and using that data to place the correct images.
thank you again, i'm just not sure i was very clear the first time.


thanks to deathead for the sig! please Click on it!
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 20th Nov 2007 00:09 Edited at: 20th Nov 2007 00:50
Nevermind.
vorconan
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 20th Nov 2007 00:44
@Blobby

So if I understand you right, you want a way of reading data from a file and creating the level out of that?



pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 20th Nov 2007 14:07
vorconan

try here

Login to post a reply

Server time is: 2024-11-25 09:22:00
Your offset time is: 2024-11-25 09:22:00