Hello!So recenty I tried to set a texture for a floor sprite I was making for a test I was doing. I was trying to create a Sprite named floor, in which the texture "terrain" would repeat itself, creating something similar to the ground in Super Mario Bros. Here is my code, where I define the afore mentioned:
sf::Texture terrain;
terrain.create(50, 50);
if (!terrain.loadFromFile("img/tile.png"))
{
std::wcout << L"No tile.png exists";
}
terrain.setRepeated(true);
sf::Sprite floor;
floor.setScale(10000.f, 1000000000.f);
floor.setPosition(0.f, 4700.f);
floor.setTexture(terrain);
For reference, the image tile.png is the following and its size is 50*50 (pixels)
However, when I draw the floor, I get this:
The brown box right Mario is the floor Sprite I defined above.
As you can see, the texture "terrain" is not repeated across the srite as intended, but rather the floor has a brown texture. How can I fix this? Am I doing something wrong?