So, Im making a game in c# using Xna. I have a function that will read a text file and display a map on screen, using numbers in the file as texture references. The file is a integer multidimensional array. I have another file which is used to set collision bounds, called collisionMap.txt.
My thinking was this:
- Read collision map file
- If any value within the array equaly '1', then that tile will be inpassable.
- Get x and y positions of that wile within the array.
- These inpassable tiles will be added to another array containing only array positions of inpassable tiles.
- Calculate screen positions of the inpassable tiles. I will do this by timising the x and y array position by the tile width and height.
- Proceeed with noral collision detection.
My question is, how can I check collisionMap.txt for any values equal to '1' and get the array position?
Any and all comments will be appreciated!