Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from turtle import *
- t1 = Turtle()
- t2 = Turtle()
- t2.shape('turtle')
- t2.penup()
- t2.width(10)
- t2.goto(-220,0)
- def labirint():
- t1.color('pink')
- t1.speed(0)
- t1.penup()
- t1.goto(-190,-200)
- t1.pendown()
- t1.begin_fill()
- for i in range(2):
- t1.forward(50)
- t1.left(90)
- t1.forward(400)
- t1.left(90)
- t1.end_fill()
- t1.penup()
- t1.goto(-70,260)
- t1.pendown()
- t1.begin_fill()
- t1.right(90)
- t1.forward(300)
- t1.left(90)
- t1.forward(200)
- t1.left(90)
- t1.forward(50)
- t1.left(90)
- t1.forward(150)
- t1.right(90)
- t1.forward(250)
- t1.left(90)
- t1.forward(50)
- t1.end_fill()
- t1.penup()
- t1.goto(-70,-260)
- t1.begin_fill()
- t1.pendown()
- t1.right(90)
- t1.forward(150)
- t1.right(90)
- t1.forward(250)
- t1.right(90)
- t1.forward(50)
- t1.right(90)
- t1.forward(200)
- t1.left(90)
- t1.forward(100)
- t1.right(90)
- t1.forward(50)
- t1.end_fill()
- labirint()
- def stepright():
- t2.penup()
- t2.goto(t2.xcor()+5,t2.ycor())
- scr = t2.getscreen()
- scr.listen()
- scr.onkey(stepright,"Right")
- def stepleft():
- t2.penup()
- t2.goto(t2.xcor()-5, t2.ycor())
- scr = t2.getscreen()
- scr.listen()
- scr.onkey(stepleft, "Left")
- def stepup():
- t2.penup()
- t2.goto(t2.xcor(), t2.ycor()+5)
- scr = t2.getscreen()
- scr.listen()
- scr.onkey(stepup, "Up")
- def stepdown():
- t2.penup()
- t2.goto(t2.xcor(), t2.ycor()-5)
- scr = t2.getscreen()
- scr.listen()
- scr.onkey(stepdown, "Down")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement