Jump to content
  • Advertisement
Sign in to follow this  
factorXero

Need Help Making a map

This topic is 2219 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

Hello! I have been working on some very small projects all of which don't require a map or background image other than a black screen. I am looking to make a pokemon type map where there is a map and buildings and what not and the character stays in the middle at all times. I am using Microsoft Visual C++ and using Allegro 5 with it.

tl:dr Need help starting to make a pokemon type map.

Any and all help is appreciated. I just need a starting point. I will put in all the work I need for the problem solving but I really dont know where to start.

Thanks!
factorXero

Share this post


Link to post
Share on other sites
Advertisement
To add to what SOTL said:

I had success years ago using a tile map editor called Mappy http://www.tilemap.co.uk/mappy.php with Allegro - there is even a "playback" library you can download that has a minimal tile engine built in.

Note that this was years ago, so I'm not sure which version of Allegro it works directly with, so YMMV.

Share this post


Link to post
Share on other sites
This goes into more detail about 2D tile maps http://wiki.sheep.art.pl/Tiled%20Map%20in%20PyGame and gives examples . You'll have to translate Python to C++, but it shouldn't be too difficult.

Share this post


Link to post
Share on other sites

Note that this was years ago, so I'm not sure which version of Allegro it works directly with, so YMMV


There are versions of Mappy for all versions of Allegro.

Share this post


Link to post
Share on other sites
Tiled maps are definitely the way to go for what you're asking. Try something like this:

1) Load the data from a .txt file that looks something like this:

1 1 1 1 1 1 1 1 1 1
1 1 0 0 0 0 0 0 1 1
1 1 0 0 0 0 0 0 1 1
1 1 0 0 0 0 0 0 1 1
1 1 1 1 1 1 1 1 1 1

2) Loop through the data from the .txt file row by row. For each 1, add a wall image, for each 0 add a floor image. Add the image to an array, with each row as its own array. Putting all of the rows in order, and another array. That makes a 2D array which would represent all of the tiles of your map.

3) In your main game loop, loop through your 2D map array, rendering each tile image at the appropriate position. I would even consider going as far as having a tile class, to create tiles for your 2d array that hold not just it's image, but also it's position, weather or not it's a walkable tile, etc. Stuff like that.

That's just a basic idea of what I would recommend, and the above would only display a room, but thats the concept. Tiled maps are actually a lot more simple than people think!

Also if you like the idea of tiled maps, when you become more familiar with them, a really interesting topic is random map generation for generating random dungeons, caves, etc. That way you don't have to load a .txt file, it's all generated. It also give each new map a whole new feel but uses the same tiled map idea. If you're interested at all here is a guide I wrote on 2D tiled random map generation.

http://breinygames.b...generation.html

It would be a pretty cool thing to implement in a pokemon style game. Good luck! Edited by breinygames

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!