I'm writing an isometric tile engine, and I can't seem to correctly piece the tiles together. There is always some kind of shadow. In the end it makes the map look like there's a grid, which isn't that bad, but I'd like to show a plain grass map. How can I achieve that?
Note: I have the same problem on two different computers, on both Windows and GNU/Linux.
Here is a simple example, with 64x30 tiles:
#include <iostream>
#include <vector>
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow app(sf::VideoMode(640, 480, 32), "Tile test");
app.SetFramerateLimit(10);
sf::Image image;
bool running = image.LoadFromFile("grass.png");
std::vector<sf::Sprite> sprites;
sf::Sprite s1(image);
s1.SetPosition(0, 0);
sprites.push_back(s1);
sf::Sprite s2(image);
s2.SetPosition(64, 0);
sprites.push_back(s2);
sf::Sprite s3(image);
s3.SetPosition(32, 15);
sprites.push_back(s3);
while (running)
{
sf::Event event;
while (app.GetEvent(event))
{
switch (event.Type)
{
case sf::Event::Closed:
running = false;
break;
default:
break;
}
}
app.Clear(sf::Color(255, 255, 255));
for (std::vector<sf::Sprite>::const_iterator it = sprites.begin();
it != sprites.end();
++it)
{
app.Draw(*it);
}
std::cout << 1.0 / app.GetFrameTime() << " FPS\n";
app.Display();
}
app.Close();
return EXIT_SUCCESS;
}
Here is the tile: