Activity 2 - Change the color of objects in game.

Great! You just fixed the game’s boundary. Now, notice how everything inside the game looks black and white? Let’s bring it to life by giving it some colors.

To do this, we need to modify the RGB values in the COLOR attribute. RGB stands for Red, Green, and Blue. On a computer screen, you can modify the color of each pixel by modifying its RGB value. You can make create about 16.7 million different colors just through a combination of different RGB values. The values are specified in same order as RGB is written. Use the color picker below to find the RGB values for your favorite color:

Find # TODO (ACTIVITY 2) in the code. Modify the COLOR attribute of Pong class. If you did this correctly, the objects will acquire the desired color. Press run and confirm the result.

Try using different RGB values to see the effect of color changes on the game’s objects.

Launch Replit

Takeaway

You have just modified the COLOR attribute in the Pong class to influence how the objects will look on-screen. You learned how to modify RGB values to get your desired color!