2d map for an rpg

Started by
43 comments, last by Toadhead 12 years, 3 months ago
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
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.
I'll ask this. How far have you gotten in creating your game?

Beginner in Game Development?  Read here. And read here.

 

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
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.

Beginner in Game Development?  Read here. And read here.

 

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.

  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 :)

Beginner in Game Development?  Read here. And read here.

 

Thanks :D I'll get to work!
Okay, got that done, now I guess I'll add collision to everything? That would be my next step?
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.

Beginner in Game Development?  Read here. And read here.

 

This topic is closed to new replies.

Advertisement