Bouncing Bubbles

 bouncing_bubbles_15.gif

 

You are given a working project that manages the (simple) movements of of a single circular shape on the screen. A very short summary of the design of this project follows:

 

animate class:

The animation class is in charge of handling the application's main loop, event handling, and drawing of the objects.

The animation class delegates the management of individual elements of the application (the shapes) to the System class.

System class:

The system class is currently in charge of creating the circular shape, calculating its position in the next frame, and drawing the object.

Random class: 

Responsible for seeding the random generator and generating random numbers in a range. 

Applications that use this class should not seed the random generator (srand( ) ).

The Bouncing Bubbles Application:

 The major difference between the sample application you are given and the application you are to deliver is the number of objects (shapes) managed.

The New System class:

The system class will now contain a vector of Particles, rather than a single sf::CircleShape. 

It will no longer calculate the position of the shape(s) or draw them. It will delegate such individual tasks to the shapes (Particles) themselves.

All System will do when it's time to draw, is to loop through all the Particles in its vector and system[i].Draw(window). Remember to pass the window object to any entity that needs to draw to the screen.

Similar organization will delegate the movement (calculating the next position) to the Particles themselves.

System CTOR: Recall that the animate object called on System to instantiate itself. In this design, the Animate will create a vector of Particles (given their initial position, velocity, acceleration, color, size, etc.) and pass this vector to System. Remember to pass a constant reference to this vector to the system and not pass it by value! System, then, will take this vector and copy it to its own internal vector.

Particle Class:

The Particle class holds an SFML shape, and its size, position, velocity, acceleration, color, etc.

It will be in charge of calculating its own position for the next frame and for drawing itself on to the screen.

Submit:

Submit as your output, a gif of 20 seconds or more (less than 60 seconds, please!) of your output.