import pgzrun
size_w = 7 # Кол-во клеток по ширине
size_h = 7 # Кол-во клеток по высоте
WIDTH = cell.width * size_w
HEIGHT = cell.height * size_h
TITLE = "The Wellkid Explorer"
my_map = [
[0, 0, 0, 0, 0, 0, 0],
[0, 1, 2, 1, 3, 1, 0],
[0, 1, 1, 2, 1, 1, 0],
[0, 3, 2, 1, 1, 3, 0],
[0, 1, 1, 1, 3, 1, 0],
[0, 1, 3, 1, 1, 2, 0],
[0, 0, 0, 0, 0, 0, 0]
]
cell = Actor('border')
cell1 = Actor('floor')
cell2 = Actor("crack")
cell3 = Actor("bones")
def map_draw():
for i in range(len(my_map)):
for j in range(len(my_map[0])):
x = j * cell.width
y = i * cell.height
if my_map[i][j] == 0:
cell0.topleft = (x, y)
cell0.draw()
elif my_map[i][j] == 1:
cell1.topleft = (x, y)
cell1.draw()
elif my_map[i][j] == 2:
cell2.topleft = (x, y)
cell2.draw()
elif my_map[i][j] == 3:
cell3.topleft = (x, y)
cell3.draw()
char = Actor('stand')
char.x = cell.width * 3
char.y = cell.height * 3
char.health = 100
char.attack = 5
def draw():
screen.clear()
map_draw()
char.draw()
screen.draw.text(f"Health: {char.health}", (10, 10), fontsize=24, color="white")
screen.draw.text(f"Attack: {char.attack}", (10, 40), fontsize=24, color="white")
pgzrun.go()