Advertisement
Guest User

Untitled

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