|
| 1 | +package day1.robot; |
| 2 | + |
| 3 | +import org.jointheleague.graphical.robot.Robot; |
| 4 | + |
| 5 | +/*** Teacher's note ***/ |
| 6 | +/* Before beginning recipe: |
| 7 | +* 1. ask students to find and explain the method in this recipe. |
| 8 | +* 2. ask students how they might use the method to make the picture in the laminated hand-outs. */ |
| 9 | + |
| 10 | +public class StarShow { |
| 11 | + |
| 12 | + Robot robot = new Robot("batman"); |
| 13 | + |
| 14 | + void makeStars() { |
| 15 | + |
| 16 | + drawStar(100); //5. delete this line. you will draw the star again in step 8. |
| 17 | + // 13. Set the speed to 8 |
| 18 | + |
| 19 | + // 6. Make a variable to hold the X position of the Robot and set it to 10 |
| 20 | + |
| 21 | + // 7. Make a variable to hold the Y position of the Robot and set it to 950 |
| 22 | + |
| 23 | + // 8. Make a variable to hold the star size and set it to 25 |
| 24 | + |
| 25 | + // 12. Repeat the steps #19 to #18, 30 times |
| 26 | + |
| 27 | + // 19. Set the pen width to i |
| 28 | + |
| 29 | + // 10. Set the X position of the robot to your X variable |
| 30 | + |
| 31 | + // 11. Set the Y position of the robot to your Y variable |
| 32 | + |
| 33 | + // 9. Call the drawStar() method with your star size variable |
| 34 | + |
| 35 | + // 14. Increase the X position by star size. See Figure 2. |
| 36 | + |
| 37 | + // 15. decrease the Y position by star size. See Figure 3. |
| 38 | + |
| 39 | + // 16. Increase the star size by 20 |
| 40 | + |
| 41 | + // 17. Turn the robot 12 degrees |
| 42 | + |
| 43 | + // 18. Make each star a different random color like in Figure 4. |
| 44 | + |
| 45 | + } |
| 46 | + |
| 47 | + private void drawStar(int starSize) { |
| 48 | + // 2. Put the robot's pen down |
| 49 | + |
| 50 | + // 4. Repeat both commands 5 times. See Figure 1 at http://bit.ly/star-show |
| 51 | + |
| 52 | + // 1. Move the robot the distance of the starSize variable |
| 53 | + |
| 54 | + // 3. Turn the robot 144 degrees |
| 55 | + |
| 56 | + } |
| 57 | + |
| 58 | + public static void main(String[] args) { |
| 59 | + new StarShow().makeStars(); |
| 60 | + } |
| 61 | +} |
| 62 | + |
| 63 | + |
| 64 | + |
0 commit comments