Kittenblock实例,动态画图
1、1设计舞台和角色角色1 = Sprite("角色1")#角色
2、2擦除画笔痕迹,给出判断,等待按下鼠标
角色1.pen_clear()#清空痕迹
while not (角色1.sensing_mousedown()):#判断,侦测鼠标按下
3、3移动到鼠标的位置
角色1.motion_gotoxy(角色1.sensing_mousex(), 角色1.sensing_mousey())#角色位置
4、4设置画笔颜色和粗细,落笔
角色1.pen_setPenColorParamTo("color", 50)
角色1.pen_setPenSizeTo(1)
角色1.pen_penDown()
5、5角色移动,1秒钟内到鼠标位置 角色1.motion_glidesecstoxy(1, 角色1.sensing_mousex(), 角色1.sensing_mousey())#移动位置
6、6通过角色移动画图
for count in range(20):#画图
for count in range(10):
角色1.motion_movesteps(20)
角色1.motion_turnleft(90)
角色1.motion_turnleft(30)
7、7调整参数,可以改变图形
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:178
阅读量:21
阅读量:69
阅读量:168
阅读量:110