Jump to content
  • Advertisement
Sign in to follow this  
deathwearer

2D map

This topic is 4667 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'm planning to make a small game like a FF game with SDL. What would be the best way to make a map? or section of map. and is there any tutorials that's explain it somewhere? Thank.

Share this post


Link to post
Share on other sites
Advertisement
There's a pretty decent selection of articles on Isometric and Tile-Based Games here on GDNET.

Basically though, its all the same: you have an array of tiles
+ + + + 
+ + + +
+ + + +
+ + + +

There are a lot of different ways to define "tiles", in my engine each tile is a pointer to an instance of a Sprite, which is a pointer to an SDL_Quad wrapper and an SDL_Surface wrapper.

For the actual storage in the array, I'd suggest a 1-dimensional array. You can get/set 2D data with the algorithm
position = y * x_size + x

I render the map with an "offset", which is essentially a value added to the coordinates of each Sprite. This allows me to scroll the map and such.

Additionally, you'll only want to blit the tiles which are visible, and blah blah so on. All this is in the articles which can be found in the above link. If you have any more specific questions, feel free to ask.

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!