Untitled

 avatar
unknown
plain_text
a year ago
922 B
17
Indexable
# Підключи потрібні модулі
from turtle import *
from random import *
from time import sleep


# Створити об'єкт "черепашка", встанови форму, колір, швидкість
t = Turtle()
t.score = 0
t.shape("turtle")
t.color("red")
t.penup()
t.speed(5)
# Визнач функцію-обробник, яка спрацьовує при натисканні мишкою на черепашку
def catch(x , y):
   t.write("A!", font = ("impact", 22))
   t.goto(randint(-180,180), randint(-180,180))
   sleep(0.1)
   t.score += 1

def move():
   t.goto(randint(-180,180), randint(-180,180))
# Об'єкт "черепашка" підписується на подію "клік"
t.onclick(catch)


while t.score < 1:
   sleep(2)
   move()
t.color("blue")
t.goto(0,0)
t.write("Ти переміг!", font = ("impact", 22))
t.hideturtle()
Editor is loading...
Leave a Comment