Page 1 of 1

Map Editor Problems

PostPosted: Fri Jul 15, 2011 5:20 am
by jimmynewguy
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?

Re: Map Editor Problems

PostPosted: Fri Jul 15, 2011 3:33 pm
by jimmynewguy
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...

Re: Map Editor Problems

PostPosted: Fri Jul 15, 2011 3:45 pm
by Game A Gogo
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!

Re: Map Editor Problems

PostPosted: Fri Jul 15, 2011 4:18 pm
by jimmynewguy
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: