I have this sprite that I am printing out

sf::Image aNimat;
if(!aNimat.LoadFromFile("images/fish.png")) std::cout<<"File not found fish.png"<<std::endl;

however I want to print it out at random places and in random numbers. Can anyone suggest how I would go about it?

Look up srand() and rand(); After that, give it a little more thought and let us know what you come up with.

>> however I want to print it out at random places and in random numbers. Can anyone suggest how I would go about it?

Depends on what you know. Here is one suggestion :

srand(time(0)); //seed random number generator
const int MAX_SPRITE = 10;
sf::Image sprites[MAX_SPRITE];
const int MAX_X = 50;
const int MIN_X = -50;
const int MAX_Y = 50;
const int MIN_Y = -50
for(int indx = 0; indx != MAX_SPRITE; ++indx){ 
 sprites[indx].posX = rand() % (MAX_X - MIN_X) + MIN_X;
 sprite[indx].posY = rand() % (MAX_Y - MIN_Y) MIN_Y;
 //and more attributes
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.