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 / Making a tile based map editor

Author
Message
tunners
14
Years of Service
User Offline
Joined: 23rd Aug 2010
Location: Leeds UK
Posted: 13th Sep 2010 05:52
I know it may be a bit ambitious for now, but I'm very interested in making a tile based map editor.

I love how games like Sonic 3 used tiles so efficiently to make some beautiful backgrounds and I would like to make one myself for future projects.

I have a bit of a concept but I have just about no clue where to start, here's a basic idea for a GUI:



Not sure if I'm going the wrong way about this or not.

My idea is to export a:

data 1,1,1,1,1
data 2,2,2,2,2
etc

memblock corresponding to which tile I place on my editor.

arrggghhh... it's so frustrating hahaha. I've always been on the graphical side of things and it's driving me nuts knowing what I want something to do but have no idea how to make it happen.

any tips/help would be VERY VERY much appreciated... I'd sleep better, trust me
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 13th Sep 2010 18:47 Edited at: 13th Sep 2010 18:48
Looks like you're on the right track with the concept. The only thing that was off to me was "-Output each tiles data to a memblock". A tile editor is basically just a 2D grid of tile numbers 3Dish if you want to have multiple layers.

To achieve this all you need is a multi-dimensional array:


The above is a map grid of 500x500 tiles.

Load the tiles as individual images and use the image numbers in the array to make the map, and when you're done save the array.

I would post more code right now but I have to go. I'll throw together an example later.

tunners
14
Years of Service
User Offline
Joined: 23rd Aug 2010
Location: Leeds UK
Posted: 15th Sep 2010 01:39
ah I see... so in terms of building an application around it I could do something like read the user's specified size

so for a 500 x 500 tile based map, i'd store something like:



I feel more confident about that bit than I do about making the whole GUI, exporting data, grid snapping etc.

would I be using something like:

"if mouse is over a certain block of a grid, paste the image to the coordinates of the top left of the grid"

?

Thanks a lot for the advice Grog
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 16th Sep 2010 07:43
Sorry I should of done the code already but I was lazy. I'll do some right now.

Quote: "I feel more confident about that bit than I do about making the whole GUI, exporting data, grid snapping etc."


We all basically start like you do with an idea and we put the idea into a picture which we can then can see the exact coordinates of everything to make the GUI exactly how we envision. Exporting data is just saving the array and any other data needed. Grid snapping is as you put "if mouse is over a certain block of a grid" the grid is just two FOR/NEXT loops for the X and Y coordinates.



The above code creates 20 tiles and shows them with an added check for the mouse coordinates and button. The FOR/NEXT loops use screen coordinates so it's easier to set a specific grid where you want the tiles to be seen. If you've never seen STEP in a FOR/NEXT loop it basically tells Darkbasic "Yes, I do want the numbers from 30 to 267 but count by increments of 32." (so the tiles aren't overlapping).

I'm only posting that part right now because it's very easy to use that same method to create the map grid. I'll let you try the map grid on your own.

leo877
16
Years of Service
User Offline
Joined: 6th Mar 2008
Location: san antonio, tx
Posted: 9th Oct 2010 04:59
this seems like soemthing to follow


Login to post a reply

Server time is: 2024-11-23 07:33:19
Your offset time is: 2024-11-23 07:33:19