Hello there, i'm new to sfml
Is it possible to create a background image. Then display it and then display another image onto this?
for example:
I create the Background with 64x64 sprites(e.g. small grass sprites)...
//Inside game loop
for(int i=0;i <= 1024;i +=64)
{
for(int j=0;j <= 768;j +=64)
{
sprite.setPosition((float)i,(float)j);
app.draw(sprite);
}
}
This works fine, but when i got a map with a dimension of 36326346x35346346 Pixels (
) this will cost a lot of time...so i want to create the background at first in a separate sprite/image, then create the foreground image and then display the stuff somehow...but i donno how to add "sprite" into another image/sprite with positioning.
Thought of something like this:
sf::Sprite tile;
//then loading the image etc...
sf::Sprite background;
for(...)
background.Draw(tile,x,y);
//Same with foreground
//Mainloop here
app.Draw(background);
app.Draw(AllNPCsAndStuff);
app.Draw(foregound);
it's similar to the RPGMaker. Backgroundtiles first, then the NPCs and then the foreground tiles.
Hope somebody can help me :>