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 / Help with 2D tile editor

Author
Message
DsarchyUK
16
Years of Service
User Offline
Joined: 21st Nov 2008
Location: UK
Posted: 10th Dec 2008 16:12
Hi I have been trying to get my head around 2D tile based games and following zenassem post http://forum.thegamecreators.com/?m=forum_view&t=34076&b=4 I have managed to get my head round most of it.

Here is what I have so far:


I have also uploaded a working compiled version with media so you can see for yourself how it works.

Basically You use WASD to move around the grid.

Holding down the Control Key will bring up the Tileset where you then select the brush you want.Then you just paint onto the grid.

Holding Shift will then give you a preview of which tiles have a collision by showing a black box. I plan to change this to a transparent sprite.


The problem I have now is.
A)How do I export this typed array, as I can't use the 'Save Array()' command, for use within my game?

and secondly if anyone can spot any areas where I could do things better please feel free to criticise

Regards,

Attachments

Login to view attachments
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Dec 2008 20:03
you'll have to manually save the array in your own file structure. For instance,you could put each element on a separate line. Each line holds the values of the UDT attributed separated by a comma or semicolon. Put a header at the top of the file first which describes how many entries there are so you'll know what size to dimension the array when you read it back in later.

zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 10th Dec 2008 20:57
I would do it exactly as Phaelax suggests. just write the data to a file, with some header info. I can work on it later, and give you a working example.

~Zenassem
DsarchyUK
16
Years of Service
User Offline
Joined: 21st Nov 2008
Location: UK
Posted: 10th Dec 2008 23:27
I think I get what you mean something like:



I had a feeling that it was going to be something along these lines, it seems to work anyway

So no need to use Memblocks or anything like that for something as simple as this? I was going to see if it was worth using memblocks to save the images of the tileset so I could merge different TileSets inside the editor itself. Am I way off here?

Thanks for your help by the way, your time is much appreciated.
Regards,
Pillarofire
20
Years of Service
User Offline
Joined: 31st Dec 2003
Location: Good Question, <looks around.>
Posted: 11th Dec 2008 10:11
You could save the filename into your file and tell your LOADMAP function to retrieve those names and load them as images.

Or if you wanted things more uniform, you could make your own image of those images and save it, then in the SAVEMAP remember its filename, and in the LOADMAP load it.

DsarchyUK
16
Years of Service
User Offline
Joined: 21st Nov 2008
Location: UK
Posted: 12th Dec 2008 23:25
Thanks for your example. From this I'll be able to mix and match tile sets saving them into my own format as well.
Cheers
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 18th Feb 2009 00:19
this post is kinda old but i just saw while i was browsing lol but i just made a tile editor eh its ok but what i did was exported into a text file and put it like this


Tile 1
0 X
0 Y
5 image num
1 collision

for each tile (makes a lengthy text file) but it loads quickly and you don't have to deal with commas and stuff inbatween the numbers lol i tried that and for some reason i couldnt get it to work lol.

oh and at the beginning i did this

Map info
map width
map height
tileset dir
tile width
tile height
numtiles

it works good for mine lol course i still have to make it so the image can have multiple lines of tiles (not to big of a deal just havn't done it yet lol)

hope that helps
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 18th Feb 2009 00:46
this post is kinda old but i just saw while i was browsing lol but i just made a tile editor eh its ok but what i did was exported into a text file and put it like this


Tile 1
0 X
0 Y
5 image num
1 collision

for each tile (makes a lengthy text file) but it loads quickly and you don\'t have to deal with commas and stuff inbatween the numbers lol i tried that and for some reason i couldnt get it to work lol.

oh and at the beginning i did this

Map info
map width
map height
tileset dir
tile width
tile height
numtiles

it works good for mine lol course i still have to make it so the image can have multiple lines of tiles (not to big of a deal just havn\'t done it yet lol)

hope that helps

Login to post a reply

Server time is: 2024-11-25 10:26:57
Your offset time is: 2024-11-25 10:26:57