""" 飞行棋演示,用python精灵模块制作的飞行棋演示小动画。 """ from sprites import * cors = [(-200,-150),(-200,-100),(-200,-50),(-200,0),(-200,50),(-200,100), (-200,150),(-150,150),(-100,150),(-100,100),(-100,50),(-100,0), (-100,-50),(-100,-100),(-50,-100),(0,-100),(50,-100),(100,-100), (100,-50),(100,0),(100,50),(100,100),(100,150),(150,150),(200,150), (200,100),(200,50),(200,0),(200,-50),(200,-100),(200,-150)] colors = makecolors() # 产生颜色表 width,height = 480,360 # 定义宽高 screen = Screen() # 新建屏幕 screen.bgcolor('black') # 背景为黑 screen.setup(width,height) # 设定宽高 square = Sprite(shape='square',visible=False) square.scale(2.4) for c in cors: square.color('gray',random.choice(colors)) square.goto(c) square.stamp() # 在飞行棋上移动的小猫 cat = Sprite('res/cat1.png',visible=False) cat.scale(0.5) cat.goto(cors[0]) cat.index = 0 cat.show() # 投射的色子 seimages = [f'sezi/{i}1.png' for i in range(1,7)] sezi = Sprite(shape=seimages,visible=False) sezi.scale(0.5) clock = Clock() running = True 以下代码省略......
下载完整源代码与素材,请
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)