I want to create a rectangle around each tile that's blocked value = true. How can I find the X and Y (on screen) coords of the each individual Tile?
\$\begingroup\$
\$\endgroup\$
You can calculate each tile position on screen if you know the width and height of each tile like this:
pos.x = x * tileWidth;
pos.y = y * tileHeight;
Therefore, you can go through all the tiles:
for(x = 0; x < tilemap.getWidth(); x++)
for(y = 0; y < tilemap.getHeight(); y++)
{
if(tilemap.tiles[x][y].blocked == true){
// This tile is blocked, get it's position on screen
pos.x = x * tileWidth;
pos.y = y * tileHeight;
}
}