-
Notifications
You must be signed in to change notification settings - Fork 791
Expand file tree
/
Copy pathSnow_03.py
More file actions
51 lines (34 loc) · 1.22 KB
/
Snow_03.py
File metadata and controls
51 lines (34 loc) · 1.22 KB
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
50
51
import arcade
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
def draw_grass():
""" Draw the ground """
arcade.draw_lrtb_rectangle_filled(0, SCREEN_WIDTH, SCREEN_HEIGHT / 3, 0, arcade.color.GREEN)
def draw_snow_person(x, y):
""" Draw a snow person """
# Draw a point at x, y for reference
arcade.draw_point(x, y, arcade.color.RED, 5)
# Snow
arcade.draw_circle_filled(300 + x, 200 + y, 60, arcade.color.WHITE)
arcade.draw_circle_filled(300 + x, 280 + y, 50, arcade.color.WHITE)
arcade.draw_circle_filled(300 + x, 340 + y, 40, arcade.color.WHITE)
# Eyes
arcade.draw_circle_filled(285 + x, 350 + y, 5, arcade.color.BLACK)
arcade.draw_circle_filled(315 + x, 350 + y, 5, arcade.color.BLACK)
def on_draw(delta_time):
""" Draw everything """
arcade.start_render()
draw_grass()
draw_snow_person(on_draw.snow_person1_x, 140)
draw_snow_person(450, 180)
on_draw.snow_person1_x = 150
def main():
arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Drawing with Functions")
arcade.set_background_color(arcade.color.DARK_BLUE)
arcade.start_render()
arcade.schedule(on_draw, 1/60)
arcade.run()
# Finish and run
arcade.finish_render()
arcade.run()
main()