The drawStar function we used in Lesson 8.10 only draws a star in one location. In this lesson we will add parameters to it so that we can call it multiple times to draw stars in different locations. To start, load your saved file from Lesson 8.10. (Click on the "File" button" at the top left of the RoboBlockly window. If you can't find your file, it may be because you didn't choose the "save file to cloud" option when saving it. If so, for this exercise we have pre-placed the code for the definitions for the drawFish, drawStar, and drawGrass functions.) Then follow the instructions in the Problem Statement.
|
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 the drawFish function definition as a model, modify the drawStar function so that it has two parameters, named star_x and star_y, that specify the (x, y) location for the star. (Review Lesson 8.6 if you need a refresher on adding parameters to functions.) Then add function calls to your program to draw stars in several locations. Don't forget to save your work to the cloud in an xml file named "YourName_Lesson8.11"! |
|
|
|||||||||||
|
|||||||||||