Here is the link to my assignment 6.
It is consisted of two moving rectangles and a couple of balls. The two rectangles move up and down and every time it collides with the border, it will change the color. For the balls, their colors are based on the collision with other balls as well as the rectangles. If they collide with other balls, the rgb value will turn into half of the sum of the other ball and itself, as if there is a passing effect. If they collide with the two rectangles, they will immediately change into the rectangle’s current color. When the number of the ball is enough, there will be some gradient effect on screen where the colors are also change all the time. Besides, the balls have attraction between each other. In order to control its speed to avoid them moving too fast, I also manipulated the parameters when they collide with each other.
Furthermore, if the user presses the mouse, their velocity will be reduced and not recover util the user releases the mouse. And I did this by changing the framerate because I didn’t find a better way to manipulate their velocities directly.