In this lesson we continue to upgrade our program to draw an underwater scene by adding the capability to draw fish of different colors. To do so, we will add three new parameters to the drawFish function--red, green, and blue--to allow us to specify hexadecimal color values for the fish color. To start, load your saved file from Lesson 8.13. (Click on the "File" button" at the top left of the RoboBlockly window.)
|
Grid Size: S M L | Simple View: | MinView: |
|
Coord: x-axis y-axis | Grid Lines: x-axis y-axis | |||
Grid: | 12x12 inches | 24x24 inches | 36x36 inches | |
72x72 inches | 96x96 inches | 192x192 inches | ||
1x1 inches | 2x2 inches | Fraction: | ||
xy-Range: | ||||
|
||||
|
||||
Quad: | 1 Quadrant | 4 Quadrants | 1&4 Quadrants | |
Units: | US Customary | Metric | Ruler: |
Labels: |
|
|
|
Font
px
|
|
Tics Lines: |
|
Width
px
|
Hash Lines: |
|
Width
px
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
|
Using your code from Lesson 8.13, add three new parameters to the drawFish function, named red, green, and blue. Modify the "fillColor" code block in the function so that it uses the "hex color with" code stub instead of the color menu. Then add function calls to your program to draw two or more fish with different colors. Remember that the hex color values run from 00 to FF and are treated as text, not numbers, so you function calls must use the text value stub (found in the Text tab menu): See the hint if you get stuck, and don't forget to save your work to the cloud in an xml file named "YourName_Lesson8.14a"! |
|
|
|||||||||||
|
|||||||||||