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! / Need some help with 2d, really my first time with tiles.

Author
Message
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 14th Jul 2007 09:00
Alright before I get flamed to death about using the search button I just wanted to know if anyone could help me. I'm terrible with finding the points on a page all I want to know is how to locate the points on the ground of the attached image. Once I know that I can freely draw more maps and not bug you anymore. I appreciate you taking the time to read this and understanding that we all had to start somewhere.

zombie (TheMoaningKiller)

Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 14th Jul 2007 09:53
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 14th Jul 2007 10:14
I tried to set it as a jpg, but I think that it stayed a fmp. I made it in your mappy, which by the way is amazing.

LBFN
18
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 15th Jul 2007 01:21
Zombie,

The file won't load into paint. You should save it as a .jpg. right now it is s_tiles.jpg.fmp. What is .fmp? Did you attempt to make it a .bmp and mis-typed?

It really is not hard to locate where you are when using 2D tiles. Fix the pic and we'll have a look.

LB
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 15th Jul 2007 08:47
LB-Yea i've been trying to turn this darned thing into a jpg file and it just does not want to budge, though why I cannot say. So um..I was wondering if maybe we could still work this out.

LBFN
18
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 15th Jul 2007 16:03
Zombinos

I'm not exactly sure where you are coming from here and I was hoping to see the image so that it would be clearer.

With 2D tiles, typically all of the tiles are designed to be the same width and height (i.e. 32 X 32, 64 X 64, etc.). You then make an array based upon how large of a map that you have. If you want a map that is 100 tiles by 100 tiles, you simply make an array map(100,100). You fill the map array with numbers that correspond to the individual tiles. For example, tile 1 = grass, tile 2 = road, tile 3- 12 are a castle, etc.

Based upon where the character is located on the map, you look at the tiles under and around him and you put in the code to handle his movement.

I can't say that I have drawn a map freehand and converted it to an array. I'm sure it could be done, but I have always done it using the tiling method.

Hope this helps. If not, let me know.

LB
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 15th Jul 2007 21:09
LB-No that was a very well done explination, i appreciate your help. I understand now, so um..thanks and have a good day!! Also, thanks for being so paitent with me.

Zombie

LBFN
18
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 16th Jul 2007 00:58
Np.

LB
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 16th Jul 2007 10:08 Edited at: 17th Jul 2007 07:03
LB-I made another image to a jpg if you wanted to look at it.


On a side note, I am hating summer so much right now. It is really screwing with my motivation to learn any coding which right now is really essential, so in case you're wondering in a few days if you don't hear from me. Most likely, sprawled on the kitchen or bathroom floor *the coolest places in the house* until i'm at a regular temp. so ya, have a good one LB and thank you for very much for your help, i've seen that array and tile data before.

Well here is the code I have so far.



It keeps telling me that the images don't exist, i have to resize them too. But its coming along okay

Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 1st Aug 2007 18:19 Edited at: 1st Aug 2007 18:21

OOPS! that's why image 2 doesn't exist Zombie.

You need to READ the map data into your array, like this


It's good that you are using DATA statements this way you can make different maps. I'm glad to see you've worked out that it's logical to have "for x" inside "for y", doesn't make any difference but shows you understand what you're doing
PLEASE INDENT YOUR CODE.

[EDIT]
OH! I was expecting a top-down map. Are you making a platform game?

Your sig was erased by a mod because it's larger than 600x120
I didn't know about that rule and it was 659 x 126!
Isn't that a little OTT? I'm gonna have to re-make it because of 65 pixels!!!
LBFN
18
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 2nd Aug 2007 02:40
Zombinos
For a 0 - 20 map on the x and y, you will need 441 pieces of data (21 images in 21 rows = 441). The data you have listed is for a 5 X 5 map, yet that would not be conducive to a side scroller (unless each tile piece is 120+ or so pixels square), so it is hard to understand what your intent is.

Also, you do need to store the data in the map array, but you would need what I would call a pointer to the data you want to display on the screen. An example:
-Your map is 100 X 100
-You want to display a 21 X 21 map on the screen
-The variable xptr holds the value 15
-The variable yptr holds the value 12
-You call a subroutine to display a 21 X 21 map starting at map(xptr,yptr). It would be like this : for y=0 to 20 ; for x=0 to 20 ; if map(x+xptr,y+yptr)>0 then paste image map(x+xptr,y+yptr),x*32,y*32 (etc.)
- You check to make sure that xptr and yptr never go beyond max-21 (in this case 100-21 or 79), so that you don't get an array exceeded error.
- To make your scrolling smoother, you could put in x and y offsets, draw the map to an unseen screen, grab the image size you want (based upon the offsets) and paste it to screen 0. There are other ways to do it, but this should work for you.

LB

Login to post a reply

Server time is: 2025-08-09 02:09:56
Your offset time is: 2025-08-09 02:09:56