SFML community forums

Help => Graphics => Topic started by: The Terminator on July 23, 2012, 03:29:14 am

Title: Best way to create tilemaps?
Post by: The Terminator on July 23, 2012, 03:29:14 am
For my engine that I'm creating, I want to include tilemap support. The problem is, I want several different things and I don't really know how to do it in a clean, simple way. A way that I know I could do it is with multidimensional arrays and manually assigning them in code, but I'm not so sure that's the easiest way. Is there a way to read the values from a txt file or XML file? I also want to make it to where some tiles have collision against them. Like for example, if you attempt to run onto a rock tile, you would collide against it and stop. Same with water, etc. Help is greatly appreciated, thank you for your time.
Title: Re: Best way to create tilemaps?
Post by: eXpl0it3r on July 23, 2012, 03:34:41 am
Ever heared of Google? ::)
Tilemaps aren't something new and there's alot of stuff out there that can teach you how to use  and imppement tilemaps. SFML has no special function specific for tilemaps.
It's adviced to use a sf::VertexArray for the drawing of the tilemap.
But maybe you're lucky and someone will explain it to you in detail here. :)

(Also the forum search function will find you a lot of topics about tilemaps...)
Title: Re: Best way to create tilemaps?
Post by: The Terminator on July 23, 2012, 03:46:13 am
Trust me, I've googled it A LOT, but I wanted to know C++/SFML specific ways to make it easier, because a lot of tutorials were with like cocos2d with Objective-C, or Java. And I'll read up on VertexArrays, and it would really be nice if somebody explained the concept just a bit  ;D
Title: Re: Best way to create tilemaps?
Post by: game_maker on July 23, 2012, 05:10:12 pm
I created a tilemap loader (credits for  eXpl0it3r).

The tiles are written this way in the file:

path.png:x:y:xscale:yscale

It's very useful.

If u want, contact me.

My MSN: pedroh.souza13@hotmail.com
Title: Re: Best way to create tilemaps?
Post by: The Terminator on July 23, 2012, 06:16:51 pm
All the tiles are going to be the same size which is 16x16 pixels, but thanks for the info