The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
9
By Guest on 4th February 2019 06:24:10 PM | Syntax: TEXT | Views: 54



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



  • Recent Pastes