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.

2D All the way! / A simple 2D tile map program, need help.

Author
Message
Graiskye
18
Years of Service
User Offline
Joined: 29th Jul 2006
Location:
Posted: 3rd Aug 2006 11:08
Hello, I am trying to make myself a simple map editor, tile based, along the lines of the RPGMaker series. I am working with DBPro, and have been largley teaching myself and have a rudimentary understanding, that is growing daily. I used to be quite adept with MS Basic way back in the day, but I havent retained much, so Im pretty much learning from scratch, just a bit about my skil level, might help, might not?
Now to the problem at hand, I have gotten so far as to be able to map the screen in a simple 'box' statement loop myself, and have worked thru several tutorials(the really good one on this site),got a handle on different vars,loops,and most of the commands needed. Im getting clearer on arrays, I understand thats how the map data is stored. I have been searching for a decent working example and the closest I can get is this bit of code I will present you with......

Now I got this of this forum, and I am sure this is close to what I have to get to but when I try to run this code, pls note I have all the media in the folder, also I havent adjusted the 'map' array yet(if that is the right word), what I mean is the original authors .bmp were named in a different scheme than what I have. I dont care what it looks like I just want to get the tiles up, then I can adjust and arrange.
The main hurdle here for me is the actual function of laying the tiles,I dont really have a good understanding of how it is working in this case(or not as it were..), so.... if any kind soul would like to help enlighten me, Id really appreciate it. Feel free to comment the code, that would really help. Any advice is welcomed.I realise I am may jumping ahead of myself, but its what I am the most stoked to learn to do, and I have always learned just by reverse engineering, its hard for me to remain interested in the learning process if I'm not having fun, ot at least working towards it. I think with a bit of assistance I can get it accomplished, then I'll move on to movement, collision and the like. Thanks for your time. Grais
Zergei
20
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 3rd Aug 2006 17:30
OK, you've got some problems with numbers. First of:



That would be a 20x22 tiled map, ok?
Next..


The map size is 800x600, tiles 32x32, and you've got 20 tiles in "x" and 20 tiles in "y". Well, it looks like mapsizex/y has no effect on your code, but if it were to, then it has some conflict with the other values. If you divide 800 by the number of tiles there would be, then you have : 800/20=40 , which means each tiles must be of 40px to fill all the screen in the "x" coordinate. So goes with "y", but here appears the other problem.
Your data statements are for a 20x22 map, but you just loading 20x20.



This part is OK, if your doing a 20x22 map, but you just loaded a 20x20 map, so it won't fully work. "n=n+1" thats doing nothing, and that "32" is actually the sprite size, if you have a variable

tilesizex = 32
tilesizey = 32

then why use a number?

Oh, and you could replace the following...


For...

I took away the n=n+1 as it had no effect.

Hope it helps, in some way.
Graiskye
18
Years of Service
User Offline
Joined: 29th Jul 2006
Location:
Posted: 3rd Aug 2006 22:30
Thank you very much. While I do not have time at the moment to work thru it, I will later. I realised after I posted that there was a problem with the numbers, and after correcting it I managed to get the program to run, but the map is printed quickly then dissapears, as I am a newbie poster I wasnt able to edit my post.
I will work thru this a bit later and let you all know how I make out. Thx again.

Login to post a reply

Server time is: 2025-05-15 14:44:46
Your offset time is: 2025-05-15 14:44:46