-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.py
More file actions
58 lines (49 loc) · 1001 Bytes
/
game.py
File metadata and controls
58 lines (49 loc) · 1001 Bytes
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
52
53
54
55
56
57
58
from turtle import *
from random import *
import turtle
import time
# SCREEN SETUP
setup(800, 500)
title("Turtle Race")
bgcolor("forestgreen")
speed(0)
# HEADING
penup()
goto(-100, 205)
color("white")
write("TURTLE RACE", font=("Arial", 20, "bold"))
# DIRT
goto(-350, 200)
pendown(
)
color("chocolate")
begin_fill()
for i in range(2):
forward(700)
right(90)
forward(400)
right(90)
end_fill()
# FINISH LINE
gap_size = 20
shape("square")
penup()
# WHITE SQUARES ROW 1
color("white")
for i in range(10):
goto(250, (170 - (i * gap_size * 2)))
stamp()
# WHITE SQUARES ROW 2
for i in range(10):
goto(250 + gap_size, ((210 - gap_size) - (i * gap_size * 2)))
stamp()
# BLACK SQUARES ROW 1
color("black")
for i in range(10):
goto(250, (190 - (i * gap_size * 2)))
stamp()
# BLACK SQUARES ROW 2
for i in range(10):
goto(251 + gap_size, ((190 - gap_size) - (i * gap_size * 2)))
stamp()
turtle.done()