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.

Newcomers DBPro Corner / 2D Grid Map

Author
Message
Gamedesign er20
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: The one place you would never look...
Posted: 18th Aug 2006 23:33
I no this is probably realy easy to do, but i'm just gonna ask.
How do I make a 2D grid map with 10 by 12 squares, something like this

Cocacola and Pepsi aren't that differnt. Deal with it.

Attachments

Login to view attachments
Whisper Wind
21
Years of Service
User Offline
Joined: 5th Apr 2003
Location:
Posted: 19th Aug 2006 00:02
First of all, you shouldn't post a bitmap because of the size

Secondly, what exactly do you mean by make a grid map? It depends on what exactly you are going to use it for.

Typically, if you wanted to make a grid map (or tile map) that was 10 x 12, you would probably make a 10 x 12 array with a tile struct as each element. The tile struct could include things like the image to use to display it, the objects currently on the tile, whether or not you can pass through the tile, etc. Tile maps are ways of organizing the world by splitting it up into easily manageable units of space which typically only have on background image, have only enough room for one character, etc... If you wanted to move a character, you would move him a tile at a time.

You can access tiles easily through the array. It should be something like (row, column) For example, to access the top left tile it is:
(0,0)

middle tile would be
(5,6)

If you wanted to display the map, you could have two nested for loops to go through each element and display the right image for each tile, for example. Anyway I hope that helps clear things up a bit. I can't really give much more information because it really depends on the structure of your game and what you want to use the grid map for.

Searching for files named 'sanity'...
No files were found.
Gamedesign er20
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: The one place you would never look...
Posted: 19th Aug 2006 01:33 Edited at: 19th Aug 2006 01:34
Sorry about the bitmap, i wasn't sure how to post a picture.

What I meant as a grid map is a square divided in to tiles, to do A* pathfinding. It say I should do that to make it easier in the tutorial you gave me the link for in my other post A* Pathfinding.... Help .http://www.policyalmanac.org/games/aStarTutorial.htm

Cocacola and Pepsi aren't that differnt. Deal with it.
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 19th Aug 2006 01:56
To post a picture, post it in the .jpg format with a lower-case ".jpg" using the browse button. Or, to make them appear in the post itself, you can upload them with photobucket or something.

Photobucket

Whisper Wind
21
Years of Service
User Offline
Joined: 5th Apr 2003
Location:
Posted: 19th Aug 2006 01:56
It might be easier if you read the entire tutorial first. Basically, you're going to want a two dimensional array, each element representing a square in the grid and can store things specific to pathfinding, such as whether it is walkable or not, whether it is "closed", or "opened", etc. It is used in the pathfinding process. At the end of the process, you'll end up with a list of which squares form up the path, you can then use that list to move entities along the path.

Searching for files named 'sanity'...
No files were found.
Gamedesign er20
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: The one place you would never look...
Posted: 19th Aug 2006 02:30
Ok I think I miss understood the tutorial, the pictures are not actually what your supposed to see but, more like guides of what you are doing. Am i right?

Cocacola and Pepsi aren't that differnt. Deal with it.
Gamedesign er20
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: The one place you would never look...
Posted: 19th Aug 2006 02:54
You know what, I don't even care about A*, I just want to know how to make this map for a pacman game

Cocacola and Pepsi aren't that differnt. Deal with it.

Attachments

Login to view attachments
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 19th Aug 2006 20:41 Edited at: 19th Aug 2006 20:44
First of all you need to understand multidimesional arrays. Entire tutorial have been written on arrays, but here is a bit of example code which can help.

This creates a random grid area


Random isn't really what you want for a world, so here is the code changed slightly to read from data statements.



Making a map as complex as the one you have posted will be difficult, so it may be best to start with a simple blocky one like mine and then improve on it. There is a way to take the image you have drawn and have dark basic pro make a multidimensional array of 1's and 0's out of it, but I won't go into that until you are comfortable with this.

Gamedesign er20
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: The one place you would never look...
Posted: 19th Aug 2006 22:06
2 Things

1. Wow Thank you so much Daemon. I had been waiting for someone to explain clearly and to the point on how to make that type of map, and you explained it very well.

2. I'm afraid I only have DBC not DBPro, is there still a way to make my map in DBC, if not I'll make an easier map seeing how I already was going to make a bunch of easier ones before i got to my real one.

Cocacola and Pepsi aren't that differnt. Deal with it.

Login to post a reply

Server time is: 2024-11-26 14:41:18
Your offset time is: 2024-11-26 14:41:18