原创

pychon刺客之移动(1)

浏览:58
更新时间:2022-11-03
发布于:广东
微信扫一扫
分享至其他
0
表情
漩涡
0/200
全部评论
吴亦淳
一只挖坑的程序猿。
作品说明
import turtle turtle.addshape("刺客1.gif") cike=turtle.Turtle() cike.shape('刺客1.gif') cike.penup() def Qian(): x=cike.xcor() y=cike.ycor() cike.goto(x,y+10) def Hou(): x=cike.xcor() y=cike.ycor() cike.goto(x,y-10) def Zuo(): x=cike.xcor() y=cike.ycor() cike.goto(x-10,y) def You(): x=cike.xcor() y=cike.ycor() cike.goto(x+10,y)
操作说明
turtle.listen() turtle.onkeypress(Qian,'w') turtle.onkeypress(Hou,'s') turtle.onkeypress(Zuo,'a') turtle.onkeypress(You,'d')