Esempio n. 1
0
        # check for closing window
        if e.type == pg.QUIT or (e.type == pg.KEYDOWN
                                 and e.key == pg.K_ESCAPE):
            game = False
        if e.type == pg.KEYDOWN and e.key == pg.K_LEFT:
            player1.goLeft = True
        elif e.type == pg.KEYUP and e.key == pg.K_LEFT:
            player1.goLeft = False
        elif e.type == pg.KEYDOWN and e.key == pg.K_RIGHT:
            player1.goRight = True
        elif e.type == pg.KEYUP and e.key == pg.K_RIGHT:
            player1.goRight = False
        elif e.type == pg.KEYDOWN and e.key == pg.K_UP:
            player1.goUp = True
        elif e.type == pg.KEYUP and e.key == pg.K_UP:
            player1.goUp = False
        elif e.type == pg.KEYDOWN and e.key == pg.K_DOWN:
            player1.goDown = True
        elif e.type == pg.KEYUP and e.key == pg.K_DOWN:
            player1.goDown = False

    player1.update()
    worldPhisics(player1)
    wallGroup.draw(mainScreen)
    prixGroup.draw(mainScreen)
    enemyGroup.draw(mainScreen)
    player1.draw(mainScreen)
    pg.display.flip()

pg.quit()