Advertisement
mmayoub

Turtle, 26.06.2021

Jun 28th, 2021
899
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. import java.awt.Color;
  2.  
  3. import unit4.turtleLib.Turtle;
  4.  
  5. public class RunTurtle {
  6.  
  7.     public static void main(String[] args) {
  8.         Turtle t = new Turtle();
  9.         t.tailDown();
  10.  
  11.         t.setTailColor(Color.BLUE);
  12.         t.moveForward(100);
  13.         t.turnRight(90);
  14.         t.moveForward(100);
  15.         t.turnRight(90);
  16.         t.moveForward(100);
  17.         t.turnRight(90);
  18.         t.setTailColor(Color.RED);
  19.         t.moveForward(200);
  20.  
  21.         t.setTailColor(Color.BLUE);
  22.         t.turnLeft(90);
  23.         t.moveForward(100);
  24.         t.turnLeft(90);
  25.         t.moveForward(100);
  26.         t.turnLeft(90);
  27.         t.moveForward(100);
  28.  
  29.         t.tailUp();
  30.         t.turnLeft(90);
  31.         t.moveBackward(200);
  32.  
  33.         t.tailDown();
  34.         t.setTailColor(Color.GREEN);
  35.         for (int i = 0; i < 20; i++) {
  36.             t.moveForward(20);
  37.             t.turnLeft(18);
  38.         }
  39.         for (int i = 0; i < 20; i++) {
  40.             t.moveForward(20);
  41.             t.turnRight(18);
  42.         }
  43.     }
  44.  
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement