Activity 2 - Change the color of objects in game.

Activity 2

Great! You just fixed the game’s boundary. Now, notice how everything inside the game looks black and white. Let’s give it some colors.

To do this, we need to modify the RGB values in COLOR attribute. RGB stands for RED, GREEN, BLUE. In a computer screen, you can modify the color of each pixel by modifying its RGB value. Every color can be represented by combination of different RGB values in it. The values are specified in same order as RGB is written. Use the color picker below to find the RGB values for your favourite 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.

Takeaway

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