Hi AndroidAddict 
For the collision detection in tile based games you have a few options depending on how fast you want to make it.
Note: i suppose you are using a two dimensional array for the tile map, that way it is much easier to get the right tile simply by knowing the coordinates of the tile in tile coordinates ((int)(ScreenPosition/tileSize))
Method A:
- Create an array in the class where you run you collision code (should not be a local variable, but an instance variable)
- Before checking collisions, get every tile around marion by tile coordinates (this works good with objects that are, at best just a little smaller than a tile)
Then you add the tiles around mario to the array, by getting them mathematically, based on marios center position.
collisionArray.add(tilemap.getTile(mario.tilePositionX-1, mario.tilePositionY-1)); /*Bottom Left*/
collisionArray.add(tilemap.getTile(mario.tilePositionX, mario.tilePositionY-1)); /*Bottom Center*/
collisionArray.add(tilemap.getTile(mario.tilePositionX+1, mario.tilePositionY-1)); /*Bottom Right*/
collisionArray.add(tilemap.getTile(mario.tilePositionX-1, mario.tilePositionY)); /*Center Left*/
collisionArray.add(tilemap.getTile(mario.tilePositionX+1, mario.tilePositionY)); /*Center Right*/
collisionArray.add(tilemap.getTile(mario.tilePositionX-1, mario.tilePositionY+1)); /*Top Left*/
collisionArray.add(tilemap.getTile(mario.tilePositionX, mario.tilePositionY+1)); /*Top Center*/
collisionArray.add(tilemap.getTile(mario.tilePositionX+1, mario.tilePositionY+1)); /*Top Right*/
- iterate the collision array and check collision against the saved tiles + check if is collideable etc.
- remove all the added tiles (empty out the collision array)
- do it again
Method B:
Get a certain region of tiles from the tile map based on marios center position.
You can loop through the tile map for this, with an offset to the left, right, top, bottom, to make sure there are always tiles in the collision array that mario collides with.
for(int y = 0; y < collisionChunkHeight; y++){
for(int x = 0; x < collisionChunkWidth; x++){
collisionArray.add(tilemap.getTile.((mario.tilePositionX-collisionChunkWidth)+x, (mario.tilePositionY-collisionChunkHeight)+y));
}
}
And then you have a region of tiles that are around mario, that you can then check the collision against.
There are a few more, in case, but i guess these are pretty simple and performant enough.