Help on Level Editor (SERIOUS)

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
derbon
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 54
Joined: Tue Jun 09, 2009 7:25 pm
Current Project: Big Nasty Enemies
Favorite Gaming Platforms: NES SMS snes PC N64 PS2 Vectrex The Arcade Machine
Programming Language of Choice: C++, Perl
Location: why shud i tell u u mite steal my tv
Contact:

Help on Level Editor (SERIOUS)

Post by derbon »

Guten Tag, I'm in serious need of a tiled level-editor, and other level-editorsare ether too confusing or crash. SO, i am going to make my own level editor with c++/allegro, and it doesn't go to well. all ive ever goten was a rectangle following your mouse into different cells,

Code: Select all


int x = ((int)mouse_x/tilesize);
int y = ((int)mouse_y/tilesize);

rect(buffer, x, y, tilesize, tilesize, makecol(255,255,255));

thats like all ive done to make it look like a level editor.

so what i really need help with is getting the tiles on da' screen using an array, and scolling, AND saving maps
i think the best paint program would be microsoft paint + paint.NET+graphics gale + Paint shop Pro 7 + photoshop CS3, it would be called Paint Gale Pro Shop.NET,

http://youtube.com/gonduda
User avatar
ibly31
Chaos Rift Junior
Chaos Rift Junior
Posts: 312
Joined: Thu Feb 19, 2009 8:47 pm
Current Project: Like... seven different ones
Favorite Gaming Platforms: Xbox 360, Gamecube
Programming Language of Choice: C++, ObjC
Location: New Jersey.

Re: Help on Level Editor (SERIOUS)

Post by ibly31 »

If you can't think of any way to implement this, I think this might be a bit too complex for you, maybe you should start with something easier. I've only used SDL, but what I did was load a tilesheet, and have an array,

int levelData[SizeX][SizeY];

and it would have a 1 for the first tile in the tilesheet, and whatever tile you want appearing at that specific place. To load, I used fstream, and I parsed through the file for integers, and then loaded them into the leveldata. To display, I just clipped the section of the tilesheet and displayed it at the X,Y coordinates of the levelData * however wide/tall your sprites are.
Image
Twitter
Website/Tumblr
My Projects

The best thing about UDP jokes is that I don’t care if you get them or not.
User avatar
derbon
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 54
Joined: Tue Jun 09, 2009 7:25 pm
Current Project: Big Nasty Enemies
Favorite Gaming Platforms: NES SMS snes PC N64 PS2 Vectrex The Arcade Machine
Programming Language of Choice: C++, Perl
Location: why shud i tell u u mite steal my tv
Contact:

Re: Help on Level Editor (SERIOUS)

Post by derbon »

ibly31 wrote:If you can't think of any way to implement this, I think this might be a bit too complex for you, maybe you should start with something easier. I've only used SDL, but what I did was load a tilesheet, and have an array,

int levelData[SizeX][SizeY];

and it would have a 1 for the first tile in the tilesheet, and whatever tile you want appearing at that specific place. To load, I used fstream, and I parsed through the file for integers, and then loaded them into the leveldata. To display, I just clipped the section of the tilesheet and displayed it at the X,Y coordinates of the levelData * however wide/tall your sprites are.
well, in allegro, im doing somethinglike this:

Code: Select all

if([i]right mouse button down)[/i]
{
map[x][y] = selectedtile;
thats how i get the map to be updated but i dont know how to get the tiles i lay on the screen

Code: Select all

for(int i; i<20; i++)
                {
                        for(int j; j<50; j++)
                        {
                                switch(map[i][j])
                                {
                                                 case 1:
                                                      masked_blit(tset,buffer, 32, 0, j*32, i*32, 32, 32);
                                                      
                                                 case 2:
                                                      masked_blit(tset,buffer, 32*2, 0, j*32, i*32, 32, 32);                                           
                                                 case 3:
                                                      masked_blit(tset,buffer, 32*3, 0, j*32, i*32, 32, 32);
                                                 
                                                 case 4:
                                                      masked_blit(tset,buffer, 32*4, 0, j*32, i*32, 32, 32);
                                                      
                                                 case 5:
                                                      masked_blit(tset,buffer, 32*5, 0, j*32, i*32, 32, 32);
                                }
                        }
                }
masked_blit() will just draws the tile on the screen.
User avatar
Netwatcher
Chaos Rift Junior
Chaos Rift Junior
Posts: 378
Joined: Sun Jun 07, 2009 2:49 am
Current Project: The Awesome Game (Actual title)
Favorite Gaming Platforms: Cabbage, Ground beef
Programming Language of Choice: C++
Location: Rehovot, Israel

Re: Help on Level Editor (SERIOUS)

Post by Netwatcher »

Oh oh, double topic post...

Get the height and width of the tiles, then the width and height of the scroll buffer, then you need to define how many tiles you want in the height and length(usually fits the screen).
post if you got all these
"Programmers are the Gods of their tiny worlds. They create something out of nothing. In their command-line universe, they say when it’s sunny and when it rains. And the tiny universe complies."
-Derek Powazek, http://powazek.com/posts/1655

blip.fm DJ profile - http://blip.fm/Noobay
current code project http://sourceforge.net/projects/vulcanengine/
User avatar
ibly31
Chaos Rift Junior
Chaos Rift Junior
Posts: 312
Joined: Thu Feb 19, 2009 8:47 pm
Current Project: Like... seven different ones
Favorite Gaming Platforms: Xbox 360, Gamecube
Programming Language of Choice: C++, ObjC
Location: New Jersey.

Re: Help on Level Editor (SERIOUS)

Post by ibly31 »

Why would you ever do all those Cases? Just do:

Code: Select all

masked_blit(tset,buffer, 32*(map[i][j]), 0, j*32, i*32, 32, 32);  
Because the only thing changing in each Case is the number... so just plug it in once and it should work.
and why did you get the tile changing when you click part done before the display? What I did first was have a tile 2D array and then just display it and manually change the numbers and see how it effects whats displaying. Get the basics of a level editor done first before the actually tile changing stuff.
Image
Twitter
Website/Tumblr
My Projects

The best thing about UDP jokes is that I don’t care if you get them or not.
User avatar
Moosader
Game Developer
Game Developer
Posts: 1081
Joined: Wed May 07, 2008 12:29 am
Current Project: Find out at: http://www.youtube.com/coderrach
Favorite Gaming Platforms: PC, NES, SNES, PS2, PS1, DS, PSP, X360, WII
Programming Language of Choice: C++
Location: Kansas City
Contact:

Re: Help on Level Editor (SERIOUS)

Post by Moosader »

I'm too lazy to explain right now.

But my map editor is open source and you can attempt to read it if you'd like.
http://www.moosader.com/app-moose-tiles.html
User avatar
Netwatcher
Chaos Rift Junior
Chaos Rift Junior
Posts: 378
Joined: Sun Jun 07, 2009 2:49 am
Current Project: The Awesome Game (Actual title)
Favorite Gaming Platforms: Cabbage, Ground beef
Programming Language of Choice: C++
Location: Rehovot, Israel

Re: Help on Level Editor (SERIOUS)

Post by Netwatcher »

Yay! thanks Moosader, I was looking for something like that.
You're my shiny pink knight on a... Moose...
"Programmers are the Gods of their tiny worlds. They create something out of nothing. In their command-line universe, they say when it’s sunny and when it rains. And the tiny universe complies."
-Derek Powazek, http://powazek.com/posts/1655

blip.fm DJ profile - http://blip.fm/Noobay
current code project http://sourceforge.net/projects/vulcanengine/
User avatar
derbon
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 54
Joined: Tue Jun 09, 2009 7:25 pm
Current Project: Big Nasty Enemies
Favorite Gaming Platforms: NES SMS snes PC N64 PS2 Vectrex The Arcade Machine
Programming Language of Choice: C++, Perl
Location: why shud i tell u u mite steal my tv
Contact:

Re: Help on Level Editor (SERIOUS)

Post by derbon »

moosaders moose tiles crashed, cuput, gone, like it never existed....
i think the best paint program would be microsoft paint + paint.NET+graphics gale + Paint shop Pro 7 + photoshop CS3, it would be called Paint Gale Pro Shop.NET,

http://youtube.com/gonduda
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Help on Level Editor (SERIOUS)

Post by dandymcgee »

derbon wrote:moosaders moose tiles crashed, cuput, gone, like it never existed....
Did you get the new version? If so, *gasp* Moosader made another boo-boo (hardcore memory leak). :shock:
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
Post Reply