Jump to content
  • Advertisement
Sign in to follow this  
stein102

2d map for an rpg

This topic is 2527 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to make a 2d rpg game, I'm stuck on how to make the map. I want to make a map with a grid, where you use the arrow keys to go from square to square. What is the best way to do this?

Thanks

Share this post


Link to post
Share on other sites
Advertisement
One way is to make just a map file with contents that may look something like:

0 1 2 5 0 1
2 3 4 1 0 2
1 0 3 4 1 0
1 2 5 3 0 1

Where each of the numbers is the id of a type of square. So '0' might be dirt, '2' might be rock, etc. The file could look like a grid so that you can easily look at it and see what everything represents.

You can also use a tool such as Mappy: http://tilemap.co.uk/mappy.php
Or just make your own tile editor.

You just need a file that has a list of all the tiles in your world, and probably some info such as width and height of the world in tiles. Then your program can just open up the file, read the info it needs (width and height), then read in the tiles one-by-one. You can organize the tiles in an array.

Share this post


Link to post
Share on other sites
I'm just starting my game now. I'm really not 100% on where to start, I thought doing the graphics would be a good start so I could see my progress as I moved on. If this is a bad idea, can you please point me in the right direction? :)

Thanks

Share this post


Link to post
Share on other sites
Before you get hung up on maps, if I were you, I'd get a character (or any object) on the screen and move him around with the arrow keys first. That's normally the first thing to accomplish.

Share this post


Link to post
Share on other sites
After that, what is the next step? Because that doesn't take much time at all? I can get that done in a few minutes.

Share this post


Link to post
Share on other sites

  1. After that get a static background on the screen and have the character/object move around in it.
  2. Add another character (NPC) that randomly moves around the screen.
  3. Get your character/object to shoot a projectile in the direction you are facing.

When you get those three things up and running, then you should be able to move on to maps. Feel free to post the code after you're done :)

Share this post


Link to post
Share on other sites
After you add collision, do the following:

  1. Have a file that has 20 letters across and 20 down. In all the grid should have 400 letters all together.
  2. Load that file, read the file one letter at a time and display each letter.
  3. Now associate a grass graphic with the letter g, rock graphic with the letter r, bush graphic with the letter b.
  4. Now create another 20 x 20 file filled with all r, g, and b's.
  5. Having the association of letter to graphic and reading that file should create a 20 x 20 map of rocks, grass, and bushes.
  6. You may or may not want to use a 2-dimensional array for this, depending on your approach.


Again, feel free to post code when you're done. But there people far more knowledgeable and experience than me that can help you with your approach, architecture, and code.


Note: see you tomorrow.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!