-
Notifications
You must be signed in to change notification settings - Fork 36
/
drawing_with_functions_3.py
49 lines (38 loc) · 1.57 KB
/
drawing_with_functions_3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""
This is a sample program to show how to draw using functions
"""
import arcade
def draw_grass():
"""
This function draws the grass.
"""
arcade.draw_lrtb_rectangle_filled(0, 800, 200, 0, arcade.color.BITTER_LIME)
def draw_pine_tree(position_x, position_y):
"""
This function draws a pine tree.
"""
# Draw the trunk
arcade.draw_rectangle_filled(position_x, position_y + 30, 30, 60, arcade.color.BROWN)
# Draw three levels of triangles
arcade.draw_triangle_filled(position_x - 70, position_y + 60,
position_x + 70, position_y + 60,
position_x, position_y + 150,
arcade.color.FOREST_GREEN)
arcade.draw_triangle_filled(position_x - 70, position_y + 100,
position_x + 70, position_y + 100,
position_x, position_y + 190,
arcade.color.FOREST_GREEN)
arcade.draw_triangle_filled(position_x - 55, position_y + 150,
position_x + 55, position_y + 150,
position_x, position_y + 230,
arcade.color.FOREST_GREEN)
# Draw the origin point, just for reference.
arcade.draw_point(position_x, position_y, arcade.color.RED, 4)
arcade.open_window(800, 600, "Drawing with Functions")
arcade.set_background_color(arcade.color.AIR_SUPERIORITY_BLUE)
arcade.start_render()
# Draw our pretty landscape
draw_grass()
draw_pine_tree(70, 90)
arcade.finish_render()
arcade.run()