Загрузка данных


import pgzrun
cell=Actor('border')
size_w=8
size_h=8
WIDTH=size_w*cell.width
HEIGHT=size_h*cell.height
TITLE='Обычный рогалик'
#0-стена,1-пол,2-трещина в полу,3-череп
my_map=[
  [0,0,0,0,0,0,0,0],
  [0,1,1,1,1,1,1,0],
  [0,1,1,2,1,3,1,0],
  [0,1,2,1,1,1,3,0],
  [0,3,1,1,2,1,1,0],
  [0,1,1,1,1,1,1,0],
  [0,2,2,2,2,2,2,0],
  [0,1,1,1,1,1,1,0],
]
level2=[
    [0,1,1,1,1,1,1,0],
    [0,1,1,2,2,3,3,0],
    [0,3,3,3,3,3,3,0],
    [0,1,2,1,2,1,2,0],
    [0,3,2,3,2,3,2,0],
    [0,1,1,1,1,3,2,0],
    [0,1,1,1,1,1,1,0],
    [0,0,0,0,0,0,0,0],
]
cell0=Actor('border')
cell1=Actor('floor')
cell2=Actor('crack')
cell3=Actor('bones')
def map_draw():
    for y in range(len(my_map)):
        for x in range(len(my_map[0])):
            cx=x*cell.width
            cy=y*cell.height
            if my_map[y][x]==0:
                cell0.topleft=(cx,cy)
                cell0.draw()
            if my_map[y][x]==1:
                cell1.topleft=(cx,cy)
                cell1.draw()
            if my_map[y][x]==2:
                cell2.topleft=(cx,cy)
                cell2.draw()
            if my_map[y][x]==3:
                cell3.topleft=(cx,cy)
                cell3.draw()
player=Actor('stand')
player.top=cell.height*2
player.left=cell.width*3
player.attack=15
player.hp=100
def draw():
    screen.clear()
    map_draw()
    player.draw()
pgzrun.go()