Hi there,
im currently trying to get my tilemap working.
mostly it works fine, but to reduce the number of
needed tiles i added the abillity to rotate a tile.
But when i actually do that i get some nasty black lines.
(See the pic i added)
Here is the code i use:
( Tilesize is 50)
MapTile.LoadFromFile("data/img/TileSet.png");
MapTile.SetSmooth(false);
maptile.SetImage(MapTile);
maptile.SetCenter(25,25);
mousetile.SetImage(MapTile);
mousetile.SetCenter(25,25);
...
// Draw Map-Tiles
for (int i = View::GetViewRect().Left/TileSize; i<View::GetViewRect().Right/TileSize && i<Game::GetMapWidth();i++)
{
for (int j = View::GetViewRect().Top/TileSize; j<View::GetViewRect().Bottom/TileSize && j<Game::GetMapHeight();j++)
{
maptile.SetPosition(i*TileSize+25,j*TileSize+25);
sf::IntRect SubRect;
if(Map[i][j]._tile==0)
{
emptytile.SetPosition(i*TileSize,j*TileSize);
renderWindow.Draw(emptytile);
}
if(Map[i][j]._tile==1)
{
SubRect.Left=0;
SubRect.Top=0;
SubRect.Right=50;
SubRect.Bottom=50;
}
if(Map[i][j]._tile==2)
{
SubRect.Left=50;
SubRect.Top=0;
SubRect.Right=100;
SubRect.Bottom=50;
}
if(Map[i][j]._tile==3)
{
SubRect.Left=0;
SubRect.Top=50;
SubRect.Right=50;
SubRect.Bottom=100;
}
if(Map[i][j]._tile==4)
{
SubRect.Left=50;
SubRect.Top=50;
SubRect.Right=100;
SubRect.Bottom=100;
}
if(Map[i][j]._tile!=0)
{
maptile.SetSubRect(SubRect);
maptile.SetRotation(Map[i][j]._direction*90);
renderWindow.Draw(maptile);
}
}
}
can someone help me with this?