Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. // Prepare Turtle to Draw
  2. hide();
  3. penUp();
  4.  
  5. // First draw the background
  6. drawBackground();
  7.  
  8. //Draw all the starfish
  9. moveTo(150,400);
  10. drawStarfish(100);
  11. moveTo(300,200);
  12. drawStarfish(200);
  13.  
  14. // Draw all the seagrass on bottom of screen
  15. moveTo(50,450);
  16. turnTo(0);
  17. drawSeagrass(5);
  18. moveTo(100,450);
  19. turnTo(0);
  20. drawSeagrass(10);
  21.  
  22. // Draw all the fish
  23. moveTo(100,100);
  24. drawFish();
  25. moveTo(200,200);
  26. drawFish();
  27.  
  28. // Make the background by drawing a large dot
  29. function drawBackground(){
  30. penColor("DarkBlue");
  31. dot(1000);
  32. }
  33.  
  34. // Draw a five pointed star with a wide pen.
  35. function drawStarfish(size){
  36. // Setting up the pen
  37. penRGB(255,0,255);
  38. penWidth(20);
  39. penDown();
  40.  
  41. turnTo(0);
  42. moveForward(size);
  43. turnRight(144);
  44. moveForward(size);
  45. turnRight(144);
  46. moveForward(size);
  47. turnRight(144);
  48. moveForward(size);
  49. turnRight(144);
  50. moveForward(size);
  51. turnRight(144);
  52. penUp();
  53. }
  54.  
  55. // Switches between left and right arcs to make sea grass
  56. function drawSeagrass(size){
  57. // Setting up the pen
  58. penRGB(0,255,0);
  59. penWidth(10);
  60. penDown();
  61.  
  62. // Draw four arcs to make grass
  63. arcLeft(30,size);
  64. arcRight(60,size);
  65. arcLeft(60,size);
  66. arcRight(60,size);
  67.  
  68. penUp();
  69. }
  70.  
  71. // Draw a single fish at current turtle location
  72. function drawFish(){
  73. // Setting up the pen
  74. penRGB(250,125,0);
  75. penWidth(30);
  76. penDown();
  77.  
  78. // Fish body
  79. dot(30);
  80. turnTo(90);
  81. moveForward(30);
  82.  
  83. // Fish tail
  84. turnLeft(30);
  85. moveForward(30);
  86. turnRight(120);
  87. moveForward(30);
  88. turnRight(120);
  89. moveForward(30);
  90. turnRight(120);
  91.  
  92. penUp();
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement