Hi,
For more accuracy, use can use a TimeStep. Same technique, but instead of tolerating the loss of x microseconds after your 100 ms, you'll save it and account it for the next execution.
// Total time passed
sf::Time elapsed_time;
sf::Clock r;
// Update/Refresh frequency
sf::Time delta_time = sf::milliseconds(100);
elapsed_time += r.restart();
// We have enough time to spawn a sprite. ( may be for several ? )
while( elapsed_time >= delta_time ){
// Spawn your sprite
// ...
// Substract the time consumed
elapsed_time -= delta_time;
}
// When it goes out of the loop, mean all your time has been consumed, and may be a portion of it less than delta_time is still available
// Then loop again and again. accordingly to your gamelogic
Just be carefull to declare elapsed_time and the Clock somewhere else, so it wont reinit its value on every call.
Best regards.