Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Prepare Turtle to Draw
- hide();
- penUp();
- // First draw the background
- drawBackground();
- //Draw all the starfish
- moveTo(150,400);
- drawStarfish(100);
- moveTo(300,200);
- drawStarfish(200);
- // Draw all the seagrass on bottom of screen
- moveTo(50,450);
- turnTo(0);
- drawSeagrass(5);
- moveTo(100,450);
- turnTo(0);
- drawSeagrass(10);
- // Draw all the fish
- moveTo(100,100);
- drawFish();
- moveTo(200,200);
- drawFish();
- // Make the background by drawing a large dot
- function drawBackground(){
- penColor("DarkBlue");
- dot(1000);
- }
- // Draw a five pointed star with a wide pen.
- function drawStarfish(size){
- // Setting up the pen
- penRGB(255,0,255);
- penWidth(20);
- penDown();
- turnTo(0);
- moveForward(size);
- turnRight(144);
- moveForward(size);
- turnRight(144);
- moveForward(size);
- turnRight(144);
- moveForward(size);
- turnRight(144);
- moveForward(size);
- turnRight(144);
- penUp();
- }
- // Switches between left and right arcs to make sea grass
- function drawSeagrass(size){
- // Setting up the pen
- penRGB(0,255,0);
- penWidth(10);
- penDown();
- // Draw four arcs to make grass
- arcLeft(30,size);
- arcRight(60,size);
- arcLeft(60,size);
- arcRight(60,size);
- penUp();
- }
- // Draw a single fish at current turtle location
- function drawFish(){
- // Setting up the pen
- penRGB(250,125,0);
- penWidth(30);
- penDown();
- // Fish body
- dot(30);
- turnTo(90);
- moveForward(30);
- // Fish tail
- turnLeft(30);
- moveForward(30);
- turnRight(120);
- moveForward(30);
- turnRight(120);
- moveForward(30);
- turnRight(120);
- penUp();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement