Skip to main content
gamedev.net
🔒 Locked

Level Editor

Started by DrewSmug 3 replies 750+ views
Original Post
DrewSmug
DrewSmug
The biggest program I've done so far is tetris with c++ and sdl. I want to just make a simple side scroller game. For now i just want to clone the first level of the original mario or whatnot. I've read other peoples comments for quite some time and people always talk about making the level with a level editor. I understand what it is, but how do you program a level editor. I don't understand the concept of being able to design a level that becomes permanent into and part of the actual program. If someone could just explain how these things work I can hopefully get started on making a small simple one for my educational purpose. thanks for any and all explanations
H_o_p_s
H_o_p_s
The first sidescroller that I made read from a text file to get tile information, for example:
000000000000030000001100002000111111111111111111111111111111

And then the program made an array that was 15x4 and place the numbers in the array, then my renderer would take the numbers and display the appropriate tile or actor there (1 was ground, 2 and 3 were monsters)

My 'level editor' first had a dialogue that set up the map size (in the above example it would be 15x4) and then it rendered the current map with all zeros. By clicking on a square it brought up a dialogue that enabled you to change the tile, or add a sprite etc.

Hope this helps.

Hops
BRING BACK THE BLACK (or at least something darker)
fearyourself
fearyourself
Another solution is the one I did... You divide your screen into four parts: a left scroll button, the current tiles, a right scroll button, tile options.

If I take back the example of Hops:


000000000000030

000001100002000

111111111111111

111111111111111


becomes

L 000000000000030 R TILES

E 000001100002000 I POSSIBLE

F 111111111111111 GH CHOOSE

T 111111111111111 T HERE


With a simple calculation of the (x,y) click you know where you are, the left button will let you scroll through the level (back to the start) and the right will let you go to the end.

Different to Hops solution, I put the tiles on the right and you can put them into different groups. This solution lets you "paint" tiles on the screen instead of having to click on one, choose the tile, click on the other choose the same tile...

Jc



anonuser
anonuser
I feel your pain on that one.

The best to attack something like that is to remember graphics are a way of displaying data. So figure out some kind of file format.

struct {
textureid;
/* other information you need to know about pertile */
TILE* tileabove; // NULL if none
TILE* tileleftof; // NULL if none
TILE* tilerightof; // NULL if none
TILE* tilebelow; // NULL if none
} TILE;


after that its pure implimentation. If you load all your textures for a list or something and want a click and place you could do this:

once you click on the texture loadtexture data do transformations. LoadIcon(); to change your icon to the image.

Once you click do the correctional math to line up with other tiles and link in other tiles.

on save write the information to a file.

Not really a great example but hope it helps.
DrewSmug
DrewSmug
Naw that all was useful, or atleast it made sense and now I can take it into consideration. I also see the advantages of the options. I also see the only use to making a level/file editor is if your going to be designing lots of levels. But once you make a game to work on one level. Then all I would have to do is use my level editor to make lots of levels. So again thanks for the help.

-DrewSmug

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.