Map Editor Problems

Non-platform specific questions.

Map Editor Problems

Postby jimmynewguy » Fri Jul 15, 2011 5:20 am

Soooo... I was making a map editor (it was brought up and I realized I've never tried one before) and I ran into a problem. It seems as though the tiles don't save or load their x's and y's right. Can anyone help out?
Attachments
Level Editor.zip
(18.64 KiB) Downloaded 79 times
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: Map Editor Problems

Postby jimmynewguy » Fri Jul 15, 2011 3:33 pm

I guess it might have something to do with how big of a number an array can hold or something? I divided its x,y by 16 when saved and mulitplied it when it was loaded so the build area is bigger but I'd prefer not to have to worry about leaving the boundaries...
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: Map Editor Problems

Postby Game A Gogo » Fri Jul 15, 2011 3:45 pm

For objects, this method is preferred. But for tiles, the other way around is preferred! Since the x and y position of tiles needs not to be pin-point precise (You don't need a tile of 1 pixel offset from the other...)

So one method consist of storing attributes from an object
So you need to store: X, Y, Type, number of objects
Something like: Objects[object_ID][attributes(x,y,type)]

The other method consist of only storing the type of tile
So you only need to store Type
something like: Tiles[x][y]

Now Tiles[x][y] is a map. array [0][0] is position 0,0 in tile form and [10][10] is position 10,10, so [x][y] is x,y...
now in each position, we will store the type of tile found. 0 would mean empty!
That way tile positioning is more reliable. The other method causes too much trouble for simple tiles, and you could end up with two tiles on one (how undesirable!)

Maybe this helped a little... It'd take me much longer to go into details!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Map Editor Problems

Postby jimmynewguy » Fri Jul 15, 2011 4:18 pm

Yea I was going to do it the other way, but it was like 4 A.M. and I guess that just made me lazy... :P I did make a way where tiles can't overlap and now you can't build out of the area allowed where I tested to be stable (well was 257 X 257 but I set it at 250 X 250 blocks to be sure) which is pretty big I guess. Should have done your way in the first place but it works now so I guess I can't really be too mad :roll:
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest