diff --git a/Spinner game.py b/Spinner game.py new file mode 100644 index 0000000..f8060f3 --- /dev/null +++ b/Spinner game.py @@ -0,0 +1,36 @@ +from turtle import * +state = {'turn': 0} +def spinner(): + clear() + angle = state['turn']/10 + right(angle) + forward(100) + dot(120, 'red') + back(100) + right(120) + forward(100) + dot(120, 'green') + back(100) + right(120) + forward(100) + dot(120, 'blue') + back(100) + right(120) + update() +def animate(): + if state['turn']>0: + state['turn']-=1 + + spinner() + ontimer(animate, 20) +def flick(): + state['turn']+=10 + +setup(420, 420, 370, 0) +hideturtle() +tracer(False) +width(20) +onkey(flick, 'space') +listen() +animate() +done() diff --git a/Spinner.py b/Spinner.py new file mode 100644 index 0000000..f8060f3 --- /dev/null +++ b/Spinner.py @@ -0,0 +1,36 @@ +from turtle import * +state = {'turn': 0} +def spinner(): + clear() + angle = state['turn']/10 + right(angle) + forward(100) + dot(120, 'red') + back(100) + right(120) + forward(100) + dot(120, 'green') + back(100) + right(120) + forward(100) + dot(120, 'blue') + back(100) + right(120) + update() +def animate(): + if state['turn']>0: + state['turn']-=1 + + spinner() + ontimer(animate, 20) +def flick(): + state['turn']+=10 + +setup(420, 420, 370, 0) +hideturtle() +tracer(False) +width(20) +onkey(flick, 'space') +listen() +animate() +done()