Python用乌龟制作一只猫和鼠标游戏

Python用乌龟制作一只猫和鼠标游戏

CSDN网友写的猫捉老鼠玩耍代码 看着不错 大师模仿一下 import turtle import time import random def up():     jerry.setheading(90)     jerry.forward(20) def down():     jerry.setheading(270)     jerry.forward(20) def left():     jerry.setheading(180)     jerry.forward(20) def right():     jerry.setheading(0)     jerry.forward(20) playground=turtle.Screen() playground.register_shape('D:/pythonlearn/tom.gif') playground.register_shape('D:/pythonlearn/jerry.gif') playground.onkey(up,'Up') playground.onkey(down,'Down') playground.onkey(left,'Left') playground.onkey(right,'Right') #监听 playground.listen() writer=turtle.Turtle() writer.color('brown') writer.hideturtle() writer.penup() writer.home() writer.write("Tom & JERRY",align='center',font=("Comic sans MS",50,"bold")) writer.goto(0,-50) writer.write("READY?3,2,1,GO",align='center',font=("Comic sans MS",20,"bold")) time.sleep(3) writer.clear() tom=turtle.Turtle() tom.shape('D:/pythonlearn/tom.gif') tom.penup() tom.goto(random.randint(-200,200),random.randint(-200,200)) tom.pendown() tom.pensize(3) tom.color('blue') jerry=turtle.Turtle() jerry.shape('D:/pythonlearn/jerry.gif')...