#pgzero
import random
# Ventana de juego
cell = Actor('border')
cell1 = Actor('floor')
cell2 = Actor("crack")
cell3 = Actor("bones")
enemy = Actor("enemy")
size_w = 9 # Anchura del campo en celdas
size_h = 10 # Altura del campo en celdas
WIDTH = [Link] * size_w
HEIGHT = [Link] * size_h
TITLE = "Mazmorras" # Título de la ventana de juego
FPS = 30 # Número de fotogramas por segundo
my_map = [[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 2, 1, 3, 1, 1, 0],
[0, 1, 1, 1, 2, 1, 1, 1, 0],
[0, 1, 3, 2, 1, 1, 3, 1, 0],
[0, 1, 1, 1, 1, 3, 1, 1, 0],
[0, 1, 1, 3, 1, 1, 2, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[-1, -1, -1, -1, -1, -1, -1, -1, -1]] # Fila de poder de ataque y salud
# Protagonista
char = Actor('stand')
[Link] = [Link]
[Link] = [Link]
[Link] = 100
[Link] = 5
#Generando Enemigos
enemies = []
for i in range(5):
x = [Link](1,7) * [Link]
y = [Link](1,7) * [Link]
enemy = Actor("enemy", topleft = (x, y))
[Link] = [Link](10,20)
[Link] = [Link](5,10)
[Link](enemy)
def map_draw():
for i in range(len(my_map)):
for j in range(len(my_map[0])):
if my_map[i][j] == 0:
[Link] = [Link]*j
[Link] = [Link]*i
[Link]()
elif my_map[i][j] == 1:
[Link] = [Link]*j
[Link] = [Link]*i
[Link]()
elif my_map[i][j] == 2:
[Link] = [Link]*j
[Link] = [Link]*i
[Link]()
elif my_map[i][j] == 3:
[Link] = [Link]*j
[Link] = [Link]*i
[Link]()
def draw():
[Link]("#2f3542")
map_draw()
[Link]()
[Link]("HP:", center=(25, 475), color = 'white', fontsize = 20)
[Link]([Link], center=(75, 475), color = 'white', fontsize = 20)
[Link]("AP:", center=(375, 475), color = 'white', fontsize = 20)
[Link]([Link], center=(425, 475), color = 'white', fontsize =
20)
for i in range(len(enemies)):
enemies[i].draw()
def on_key_down(key):
if [Link] and char.x + [Link] < WIDTH - [Link]:
char.x += [Link]
[Link] = 'stand'
elif [Link] and char.x - [Link] > [Link]:
char.x -= [Link]
[Link] = 'left'
elif [Link] and char.y + [Link] < HEIGHT - [Link]*2:
char.y += [Link]
elif [Link] and char.y - [Link] > [Link]:
char.y -= [Link]