用户:
哈哈欧欧查看:0 回复:0 评论:0 创建时间:2020-08-31T13:15:04
【作品展示】

【作品介绍】
一个简单的小动画
【作品源代码】
import pgzrun
HEIGHT = 600
WIDTH = 800
x = WIDTH/2
y = HEIGHT/2
speed_y = 3
speed_x = 3
r = 30
def draw():
screen.fill('white')
screen.draw.filled_circle((x, y), r, 'blue')
def update():
global x, y, speed_x, speed_y
x = x+speed_x
y = y+speed_y
if x >= WIDTH-r or x <= r:
speed_x = -speed_x
if y >= HEIGHT-r or y <= r:
speed_y = -speed_y
pgzrun.go()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn