Creating enemy sprites procedurally
Having the ability to render to sf::RenderTexture
and store the results opens up a world of possibilities. One of these is combining multiple sprites to create new, more versatile ones. We can draw to an sf::RenderTexture
class multiple times, and the sprites will overlap. This is an incredibly useful technique that can be used to generate a vast amount of sprite variations without all the work. This is shown in the following screenshot:
Using this approach, we'll create random armor for our enemies. We'll have three pieces of armor; head, torso, and legs. For each of these, we'll also have three variations; bronze, silver, and gold. This alone gives us a large number of possible combinations. Then, let's consider that we need this for each character, of which we have two, and each character has eight sprites. That's an enormous number of textures. It's totally out of the question to create all of them manually.
Breaking sprites into components
The armor...