2D tile maps using C++ and DirectX

Started by
1 comment, last by esgol 12 years, 2 months ago
Got my tile maps loaded using a multi-dimensional array. Now I am trying to figure out how to add values to the tiles for use in collision detection. If anyone could point me in the right direction/give me a code snippet that may help, I would appreciate it.
Advertisement
You tilemap array just points to different index in your tilesheet. So when you do collision you take the index from the array and grab the tile it represent in your tilesheet. What you can is create TileProperty structure and put all the properties an tile can have in there. Then your tile index in your array can reference an TileProperty which contains teh information about the particular tile you are colliding with. A similar routine can be used to draw your maps as well. I hope that helps
BornToCode is wright. DO NOT TRY TO REFERENCE the entire collision system or whatever esle you have BY THE DIRECT SCENE X,Y VALUES, IT WILL BE MESS WITH NO END

This topic is closed to new replies.

Advertisement