Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 14.20 KB | None | 0 0
  1. speed(0)
  2. bgcolor((0,235,260,0.5))
  3. penup()
  4. x=-290
  5. y=100
  6. setposition(x,y)
  7. r=220
  8. setposition(-200,0)
  9.  
  10. #this function makes the sky
  11. def rectangle(color_choice):
  12.     begin_fill()
  13.     color(color_choice)
  14.     for i in range(8):
  15.         forward(400)
  16.         left(90)
  17.     end_fill()
  18.     left(90)
  19.     forward(13)
  20.     right(90)
  21.    
  22.    
  23. for i in range(16):    
  24.     r=r-10
  25.     rectangle((r,225,255))
  26.    
  27.  
  28.    
  29.    
  30.  
  31. penup()
  32. setposition(-190,150)
  33.  
  34. def clouds(size):
  35.     for i in range(4):
  36.         pendown()
  37.         left(180)
  38.         color("white")
  39.         begin_fill()
  40.         backward(size)
  41.         right(90)
  42.         circle(size/9,100,0)
  43.         right(90)
  44.         circle(size/5,120,0)
  45.         right(90)
  46.         circle(size/6,146,0)
  47.         right(90)
  48.         circle(size/1.9,30,0)
  49.         end_fill()
  50.         right(216)
  51.         size=size-10        
  52.         forward(size)
  53. def theclouds():
  54.     clouds(60)
  55.     penup()
  56.     setposition(-50,140)
  57.     clouds(30)
  58.     clouds(60)
  59.     penup()
  60.     setposition(-200,100)
  61.     clouds(80)
  62.     penup()
  63.     setposition(-10, 180)
  64.     clouds(30)
  65.     penup()
  66.     setposition(0,0)
  67.    
  68. theclouds()
  69.  
  70.  
  71.  
  72. def cloud_mountain(size):
  73.     for i in range(4):
  74.         pendown()
  75.         right(180)
  76.         color("white")
  77.         begin_fill()
  78.         backward(size)
  79.         right(90)
  80.         circle(size/9,100,0)
  81.         right(90)
  82.         circle(size/5,120,0)
  83.         right(90)
  84.         circle(size/6,146,0)
  85.         right(90)
  86.         circle(size/1.9,30,0)
  87.         end_fill()
  88.         right(216)
  89.         size=size-10        
  90.         forward(size)
  91. def themountainclouds():
  92.     penup()
  93.     home()
  94.     setposition(-10,10)
  95.     pendown()
  96.     cloud_mountain(50)
  97.     penup()
  98.     home()
  99.     setposition(-100,10)
  100.     pendown()
  101.     cloud_mountain(40)
  102.     penup()
  103.     home()
  104.     setposition(110,10)
  105.     pendown()
  106.     cloud_mountain(60)
  107.    
  108. themountainclouds()
  109.  
  110.  
  111.  
  112.  
  113.  
  114. speed(0)
  115. penup()
  116. setposition(-200,0)
  117.  
  118. r=200
  119. def rectanglerefl(color_choice):
  120.     begin_fill()
  121.     color(color_choice)
  122.     for i in range(8):
  123.         forward(400)
  124.         right(90)
  125.     end_fill()
  126.     right(90)
  127.     forward(13)
  128.     left(90)
  129.    
  130.    
  131. for i in range(16):    
  132.     r=r-10
  133.     rectanglerefl((r,225,255))
  134.    
  135. penup()
  136. setposition(-190,-150)
  137.  
  138. def clouds(size):
  139.     for i in range(4):
  140.         pendown()
  141.         left(180)
  142.         color("white")
  143.         begin_fill()
  144.         backward(size)
  145.         right(90)
  146.         circle(size/9,100,0)
  147.         right(90)
  148.         circle(size/5,120,0)
  149.         right(90)
  150.         circle(size/6,146,0)
  151.         right(90)
  152.         circle(size/1.9,30,0)
  153.         end_fill()
  154.         right(216)
  155.         size=size-10        
  156.         forward(size)
  157. def theclouds():
  158.     clouds(60)
  159.     penup()
  160.     setposition(-50,-140)
  161.     clouds(30)
  162.     clouds(60)
  163.     penup()
  164.     setposition(-200,-100)
  165.     clouds(80)
  166.     penup()
  167.     setposition(-10, -180)
  168.     clouds(30)
  169.     penup()
  170.     setposition(0,0)
  171.    
  172. theclouds()
  173.  
  174.  
  175.  
  176. def cloud_mountain(size):
  177.     for i in range(4):
  178.         pendown()
  179.         right(180)
  180.         color("white")
  181.         begin_fill()
  182.         backward(size)
  183.         right(90)
  184.         circle(size/9,100,0)
  185.         right(90)
  186.         circle(size/5,120,0)
  187.         right(90)
  188.         circle(size/6,146,0)
  189.         right(90)
  190.         circle(size/1.9,30,0)
  191.         end_fill()
  192.         right(216)
  193.         size=size-10        
  194.         forward(size)
  195. def themountainclouds():
  196.     penup()
  197.     home()
  198.     setposition(-10,-10)
  199.     pendown()
  200.     cloud_mountain(50)
  201.     penup()
  202.     home()
  203.     setposition(-100,-10)
  204.     pendown()
  205.     cloud_mountain(40)
  206.     penup()
  207.     home()
  208.     setposition(110,-10)
  209.     pendown()
  210.     cloud_mountain(60)
  211.    
  212. themountainclouds()
  213.  
  214. import random, turtle
  215.  
  216. speed(0)
  217.  
  218. #draws large background mountain
  219. def large_mountain():
  220.    
  221.     #setting up to draw mountain
  222.     penup()
  223.     setposition(-125,0)
  224.     pendown()
  225.     begin_fill()
  226.     color("#c6ccc6")
  227.     pensize(10)
  228.    
  229.     #sets parameters for tracy to move forward at a random angle on intervals until she reaches a certain coordinate
  230.     while ycor() <= 150:
  231.         length=random.randint(5,15)
  232.         angle=random.randint(40,45)
  233.         left(angle)
  234.         forward(length)
  235.         right(angle)
  236.         if ycor() >= 150:
  237.             break
  238.     #after passing above coordinate, tracy will start moving towards ycoordinate 0
  239.     while ycor() >= 0:
  240.         pensize(1)
  241.         color("#878c88")
  242.         length=random.randint(5,15)
  243.         angle=random.randint(40,45)
  244.         right(angle)
  245.         forward(length)
  246.         left(angle)
  247.         if ycor() <= 0:
  248.             break
  249.     end_fill()
  250.  
  251. #draws small mountain
  252. def small_long_mountain():    
  253.     penup()
  254.     setposition(-75,0)
  255.     pendown()
  256.     begin_fill()
  257.     pensize(10)
  258.     color("#6d8f6d")
  259.    
  260.     #setting coordinate for tracy to reach
  261.     while ycor() <= 50:
  262.         length=random.randint(5,10)
  263.         angle=random.randint(35,40)
  264.         left(angle)
  265.         forward(length)
  266.         right(angle)
  267.         if ycor() >= 50:
  268.             break
  269.        
  270.     #setting coordinate for tracy to reach
  271.     while ycor() >= 0:
  272.         pensize(1)
  273.         color("#5b6e5f")
  274.         length=random.randint(5,10)
  275.         angle=random.randint(35,40)
  276.         right(angle)
  277.         forward(length)
  278.         left(angle)
  279.         if ycor() <= 0:
  280.            
  281.             break
  282.        
  283.     end_fill()
  284.  
  285. #draw double mountain        
  286. def small_mountains():    
  287.     pendown()
  288.     begin_fill()
  289.     pensize(10)
  290.     color("#a9c2a9")
  291.    
  292.     #setting coordinate for tracy to reach
  293.     while ycor() <= 50:
  294.         length=random.randint(5,10)
  295.         angle=random.randint(48,52)
  296.         left(angle)
  297.         forward(length)
  298.         right(angle)
  299.         if ycor() >= 50:
  300.             break
  301.        
  302.     #setting coordinate for tracy to reach
  303.     while ycor() >= 30:
  304.         color("#a9c2a9")
  305.         length=random.randint(5,10)
  306.         angle=random.randint(48,52)
  307.         right(angle)
  308.         forward(length)
  309.         left(angle)
  310.         if ycor() <= 30:
  311.             break
  312.        
  313.     #setting coordinate for tracy to reach
  314.     while ycor() <= 75:
  315.         color("#a9c2a9")
  316.         length=random.randint(5,10)
  317.         angle=random.randint(48,52)
  318.         left(angle)
  319.         forward(length)
  320.         right(angle)
  321.         if ycor() >= 75:
  322.             break
  323.        
  324.     #setting coordinate for tracy to reach
  325.     while ycor() >= 0:
  326.         color("#6e8a73")
  327.         pensize(1)
  328.         color("#6e8a73")
  329.         length=random.randint(5,10)
  330.         angle=random.randint(48,52)
  331.         right(angle)
  332.         forward(length)
  333.         left(angle)
  334.         if ycor() <= 0:
  335.             break
  336.     end_fill()
  337.    
  338. #draw reflection, with slight changes to make it more realistic
  339. def large_mountain_flipped():
  340.     penup()
  341.     setposition(-125,-10)
  342.     pendown()
  343.     begin_fill()
  344.     color("#c6ccc6")
  345.     pensize(10)
  346.    
  347.     #path to coordinate will vary slightly from the original
  348.     while ycor() >= -150:
  349.         length=random.randint(5,15)
  350.         angle=random.randint(40,45)
  351.         right(angle)
  352.         forward(length)
  353.         left(angle)
  354.         if ycor() >= 150:
  355.             break
  356.     #path to coordinate will vary slightly from the original
  357.     while ycor() <= -10:
  358.         pensize(1)
  359.         color("#878c88")
  360.         length=random.randint(5,15)
  361.         angle=random.randint(40,45)
  362.         left(angle)
  363.         forward(length)
  364.         right(angle)
  365.         if ycor() >= -10:
  366.             break
  367.     end_fill()
  368.    
  369. #draw reflection, with slight changes to make it more realistic
  370. def small_long_mountain_flipped():    
  371.     penup()
  372.     setposition(-75,-10)
  373.     pendown()
  374.     begin_fill()
  375.     pensize(10)
  376.     color("#6d8f6d")
  377.    
  378.     #path to coordinate will vary slightly from the original
  379.     while ycor() >= -60:
  380.         length=random.randint(5,10)
  381.         angle=random.randint(35,40)
  382.         right(angle)
  383.         forward(length)
  384.         left(angle)
  385.         if ycor() <= -60:
  386.             break
  387.        
  388.     #path to coordinate will vary slightly from the original
  389.     while ycor() <= -10:
  390.         color("#5b6e5f")
  391.         pensize(1)
  392.         length=random.randint(5,10)
  393.         angle=random.randint(35,40)
  394.         left(angle)
  395.         forward(length)
  396.         right(angle)
  397.         if ycor() >= -10:
  398.             break
  399.     end_fill()
  400.  
  401. #draw reflection, with slight changes to make it more realistic
  402. def small_mountains_flipped():    
  403.     pendown()
  404.     begin_fill()
  405.     pensize(10)
  406.     color("#a9c2a9")
  407.    
  408.     #path to coordinate will vary slightly from the original
  409.     while ycor() >= -60:
  410.         length=random.randint(5,10)
  411.         angle=random.randint(48,52)
  412.         right(angle)
  413.         forward(length)
  414.         left(angle)
  415.         if ycor() <= -60:
  416.             break
  417.        
  418.     #path to coordinate will vary slightly from the original
  419.     while ycor() <= -40:
  420.         length=random.randint(5,10)
  421.         angle=random.randint(48,52)
  422.         left(angle)
  423.         forward(length)
  424.         right(angle)
  425.         if ycor() >= -40:
  426.             break
  427.     while ycor() >= -85:
  428.         length=random.randint(5,10)
  429.         angle=random.randint(48,52)
  430.         right(angle)
  431.         forward(length)
  432.         left(angle)
  433.         if ycor() <= -85:
  434.             break
  435.     while ycor() <= -10:
  436.         color("#6e8a73")
  437.         pensize(1)
  438.         length=random.randint(5,10)
  439.         angle=random.randint(48,52)
  440.         left(angle)
  441.         forward(length)
  442.         right(angle)
  443.         if ycor() >= -10:
  444.             break
  445.     end_fill()
  446.  
  447. #draws complete scene and reflection
  448. def complete_mountain_and_reflection():
  449.     large_mountain()
  450.     small_long_mountain()
  451.     small_mountains()
  452.     penup()
  453.     home()
  454.     pendown()
  455.     large_mountain_flipped()
  456.     small_long_mountain_flipped()
  457.     small_mountains_flipped()
  458.    
  459. complete_mountain_and_reflection()
  460.  
  461. import random, turtle
  462. speed(0)
  463. penup()
  464.  
  465. #Adjust evergreen size
  466. leaves_size=random.randint(23,25)
  467. tree_height=random.randint(3,4)
  468. stump_size=25
  469. stump_size_2=10
  470.  
  471. #These lines of code are for parts of the first tree (stump)
  472. def draw_stump():
  473.     pendown()
  474.     pensize(5)
  475.     color("#8B5725")
  476.     backward(stump_size)
  477.     penup()
  478.     forward(stump_size)
  479. #These lines of code are for parts of the second tree (stump)
  480. def draw_stump_2():
  481.     global stump_size_2
  482.     pendown()
  483.     pensize(5)
  484.     color("#8B5725")
  485.     backward(stump_size_2)
  486.     penup()
  487.     forward(stump_size)
  488.     stump_size_2=stump_size_2+1
  489. #These lines of code are for parts of the first tree (leaves)
  490. def leaves():
  491.     colors  = ["#22391F","#14210F","#4A5E30","#6d4919","#4B1C00","#14210F","#14210F","#14210F"]
  492.     colorchoice = random.choice(colors)
  493.     color(colorchoice)
  494.     begin_fill()
  495.     for i in range(tree_height):
  496.         forward(leaves_size)
  497.         pendown()
  498.         left(90)
  499.         circle(leaves_size,360,3)
  500.         right(90)
  501.         penup()
  502.     end_fill()
  503. #These lines of code are for parts of the second tree (leaves)
  504. def leaves_2():
  505.     colors  = ["#22391F","#14210F","#4A5E30","#4B1C00","#14210F","#14210F","#14210F"]
  506.     colorchoice = random.choice(colors)
  507.     color(colorchoice)
  508.     begin_fill()
  509.     for i in range(tree_height):
  510.         pendown()
  511.         left(90)
  512.         circle(10,360,3)
  513.         right(90)
  514.         penup()
  515.         forward(10)
  516.     end_fill()
  517.  
  518. #These lines of code are for drawing the first tree
  519. def evergreen_1():
  520.     global leaves_size
  521.     draw_stump()
  522.     leaves()
  523.     if xcor()<=-100:
  524.         leaves_size=leaves_size-1
  525.     else:
  526.         leaves_size=leaves_size-2
  527. #These lines of code are for drawing the left island
  528. def land_left():
  529.     penup()
  530.     setposition(-200,-37)
  531.     pendown()
  532.     begin_fill()
  533.     color("#8FA014")
  534.     right(90)
  535.     while xcor() <= -60:
  536.         forward(30)
  537.         right(3)
  538.     right(165)
  539.     forward(150)
  540.     end_fill()
  541.     penup()
  542. #These lines of code are for drawing the left scenary (including land and trees)
  543. def left_scenary():
  544.     x_position=-190
  545.     y_position=-10
  546.     for i in range(7):
  547.         setposition(x_position,y_position)
  548.         evergreen_1()
  549.         x_position=x_position+20
  550.         y_position=y_position-3
  551.     land_left()
  552. #These lines of code are for drawing the right island
  553. def land_right():
  554.     penup()
  555.     setposition(200,-25)
  556.     pendown()
  557.     begin_fill()
  558.     while xcor() >=-9:
  559.         forward(50)
  560.         left(2)
  561.     left(170)
  562.     forward(258)
  563.     end_fill()
  564. #These lines of code are for the second tree
  565. def evergreen_2():
  566.     draw_stump_2()
  567.     leaves_2()
  568. #These lines of code are for drawing the right scenary (including land and trees)
  569. def right_scenary():
  570.     land_right()
  571.     penup()
  572.     x_position=-40
  573.     y_position=-26
  574.     left(90)
  575.     for i in range(16):
  576.         setposition(x_position,y_position)
  577.         pendown()
  578.         evergreen_2()
  579.         x_position=x_position+15
  580.         y_position=y_position+2
  581.  
  582. #These lines of code are for drawing the right scenary reflection (including land and trees)
  583. def reflect_left_scenary():
  584.     x_position=-190
  585.     y_position=-100
  586.     left(180)
  587.     for i in range(7):
  588.         setposition(x_position,y_position)
  589.         evergreen_1()
  590.         x_position=x_position+20
  591.         y_position=y_position+3
  592.     right(90)
  593.     penup()
  594.     right(180)
  595.     setposition(-200,-73)
  596.     color((143,160,20,0.6))
  597.     begin_fill()
  598.     while xcor() <= -60:
  599.         forward(30)
  600.         left(3)
  601.     left(165)
  602.     forward(150)
  603.     end_fill()
  604. #These lines of code are for drawing the left scenary reflection (including land and trees)
  605. def reflect_right_scenary():
  606.     x_position=-40
  607.     y_position=-76
  608.     penup()
  609.     setposition(200,-65)
  610.     color((143,160,20,0.6))
  611.     begin_fill()
  612.     while xcor() >=-9:
  613.         forward(50)
  614.         right(2)
  615.     right(170)
  616.     forward(258)
  617.     end_fill()
  618.     right(90)
  619.     for i in range(16):
  620.         setposition(x_position,y_position)
  621.         pendown()
  622.         evergreen_2()
  623.         x_position=x_position+15
  624.         y_position=y_position-2
  625. #These lines of code will execute the commands needed to draw the trees and land
  626. left(90)
  627. left_scenary()
  628. right_scenary()
  629. reflect_left_scenary()
  630. reflect_right_scenary()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement