Hi guys
I'm still working on my Project and the next Problem has occured: How do I detect collisions on a tilebased map? My tiles are 16x16 and the map is based on the tutorial of sdltutorials.com (
http://www.sdltutorials.com/sdl-maps). I really like this Approach because I can define for each tile of what type it should be (so a earth tile can be walkable and lead to a secret passage).
The first Number stands for what Kind of tile it should be (e.g. Grass, Earth, Water, Blank,...) and the number after ":" stands for the type of the tile (e.g. solid, walkable, do dmg to the Player,...).
e.g.
0:0 0:0 0:0 0:0 0:0 //No tile and walkable
0:0 0:0 0:0 0:0 0:0
0:0 0:0 0:0 0:0 0:0
1:1 1:1 1:1 1:1 1:1 //Grass tile and solid
2:1 2:1 2:1 2:1 2:1 //Earth tile and solid
It's working just fine with loading the Images, but i've got no clue about the collision.
I've already read a lot of stuff on the Internet but I don't get how to Combine it the structure from above. For example lazyfoo describes the collision with one object like one wall. So how can I check the Player Position with each tile?
Do you even have some better ways of doing this? For now there's no camera, but I plan to implement one later...
Thx for your suggestions
Half_NOoB
(EDIT: I'm trying to make a 2D platformer...)