-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathscript_target_v1.py
50 lines (40 loc) · 1.02 KB
/
script_target_v1.py
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
import turtle
tammy = turtle.Turtle()
tammy.color("green")
tom = turtle.Turtle()
tom.color("blue")
tere = turtle.Turtle()
tere.color("yellow")
fimx = 200
fimy = 250
target = turtle.Turtle()
target.shape("turtle")
target.color("red","red")
target.pu()
target.setpos(fimx,fimy)
target.stamp()
while tom.pos()[0]!=target.pos()[0]:
tom.fd(10)
tom.left(90)
while tom.pos()[1]!=target.pos()[1]:
tom.fd(10)
while tere.pos()[0]!=target.pos()[0] and tere.pos()[1]!=target.pos()[1]:
tere.fd(50)
tere.left(90)
tere.fd(50)
tere.right(90)
tere.fd(30)
if tere.pos()!=target.pos():
tere.goto(target.pos())
if (tammy.pos()[1]-target.pos()[1])>0:
tammy.seth(270)
tammy.fd(tammy.pos()[1]-target.pos()[1])
elif(tammy.pos()[1]-target.pos()[1])<0:
tammy.seth(90)
tammy.fd(target.pos()[1]-tammy.pos()[1])
if (tammy.pos()[0]-target.pos()[0])>0:
tammy.seth(180)
tammy.fd(tammy.pos()[0]-target.pos()[0])
elif(tammy.pos()[0]-target.pos()[0])<0:
tammy.seth(0)
tammy.fd(target.pos()[0]-tammy.pos()[0])