Skip to content

Commit 189a858

Browse files
authored
Add files via upload
1 parent 32c6c8b commit 189a858

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#The logic of the game is that the turns will keep increasing as
2+
#you press the space bar, and it will reduce its speed and
3+
#stop at a point where you stop pressing the space bar.
4+
5+
from distutils.core import setup
6+
from turtle import *
7+
state = {'turn': 0}
8+
#definning the spinner
9+
def spinner():
10+
clear()
11+
angle = state['turn']/10
12+
right(angle)
13+
forward(100)
14+
dot(120, 'red')
15+
back(100)
16+
right(120)
17+
forward(100)
18+
dot(120, 'brown')
19+
back(100)
20+
right(120)
21+
forward(100)
22+
dot(120, 'orange')
23+
back(100)
24+
right(120)
25+
update()
26+
#creating the animation
27+
def animate():
28+
if state['turn']>0:
29+
state['turn']-=1
30+
31+
spinner()
32+
ontimer(animate, 20)
33+
def flick():
34+
state['turn']+=10
35+
36+
setup(420, 420, 370, 0)
37+
hideturtle()
38+
tracer(False)
39+
width(20)
40+
onkey(flick, 'space')
41+
listen()
42+
animate()
43+
done()

0 commit comments

Comments
 (0)