Exemple #1
0
def main_loop(level):

    _grille = Grille(level)
    _grille.drawMap(screen)
    _player = Player(_grille)
    _player.drawPlayer(screen)
    pygame.display.update()
    background = pygame.image.load("img/back.png")

    while not _grille.is_fini():

        for event in pygame.event.get():
            if event.type == QUIT:
                sys.exit()
            if event.type == KEYDOWN:
                _player.move(event.key)

                if event.key == K_r:
                    _grille.genMap(level)
                    _grille.drawMap(screen)
                    _player = Player(_grille)
                    _player.drawPlayer(screen)
                if event.key == K_q:
                    sys.exit()
                l = 0
                if event.key == K_p:
                    for level in lvl:
                        main_loop(lvl[l])
                    l += 1

        screen.blit(background, (150, 100))
        _grille.drawMap(screen)
        _player.drawPlayer(screen)
        pygame.display.update()
Exemple #2
0
pygame.display.set_caption(TITRE)

background = pygame.image.load("img/back.png")

screen.blit(background, (0, 0))

_grille = Grille("lvl/lv1")
_grille.drawMap(screen)

_player = Player(_grille)
_player.drawPlayer(screen)

pygame.display.flip()

continuer = True
while not _grille.is_fini():
    for event in pygame.event.get():
        if event.type == QUIT:
            sys.exit()
        if event.type == KEYDOWN:
            _player.move(event.key)
            if event.key == K_r:
                _grille.genMap("lvl/lv1")
                _grille.drawMap(screen)
                _player = Player(_grille)
                _player.drawPlayer(screen)
    screen.blit(background, (0, 0))
    _grille.drawMap(screen)
    _player.drawPlayer(screen)
    pygame.display.flip()
Exemple #3
0
background = pygame.image.load("img/back.png")

screen.blit(background, (0,0))

_grille = Grille("lvl/lv1")
_grille.drawMap(screen)

_player = Player(_grille)
_player.drawPlayer(screen)

pygame.display.flip()

continuer = True
while not _grille.is_fini():
    for event in pygame.event.get():
        if event.type == QUIT:
            sys.exit()
        if event.type == KEYDOWN:
            _player.move(event.key)
            if event.key == K_r:
                _grille.genMap("lvl/lv1")
                _grille.drawMap(screen)
                _player = Player(_grille)
                _player.drawPlayer(screen)
    screen.blit(background, (0,0))
    _grille.drawMap(screen)
    _player.drawPlayer(screen)
    pygame.display.flip()