用户:
深情~与你查看:0 回复:0 评论:0 创建时间:2024-01-24T10:33:56
【作品展示】

【作品介绍】
xcasaaxaX
【作品源代码】
import turtle
size = 70
grid = [[0,0,1,1,1,0],
[0,0,1,3,1,1],
[1,1,1,2,2,1],
[1,3,4,4,2,1],
[1,1,2,2,2,1],
[0,1,1,1,1,1]]
width = len(grid[0])
height = len(grid)
origin_x = -(width-1) / 2 * size
origin_y = (height-1) / 2 * size
tile_shapes = ['空.gif','墙壁.gif','通道.gif','目标.gif','箱子.gif']
for i in tile_shapes:
turtle.addshape(i)
p = turtle.Pen()
p.penup()
p.hideturtle()
for i in range(width):
for j in range(height):
p.goto(origin_x + i * size, origin_y - j * size)
p.shape(tile_shapes[grid[j][i]])
p.stamp()
turtle.done()
#if grid[j][i] == 1:
# p.shape('墙壁.gif')
# else:
# p.shape('通道.gif')
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn