コード例 #1
0
ファイル: GameMain.py プロジェクト: gramib/BradenCannon
    def __init__(self, width = 1000, height=500):

        pygame.init()

        self.width = width
        self.height = height
        self.screen = pygame.display.set_mode((self.width, self.height))
        self.running = 1
        self.clock = pygame.time.Clock()

        pygame.display.set_caption('Earth Defense')

        self.firingManager = FiringManager()
        self.gameLogicManager = GameLogicManager()
        self.alienManager = AlienManager()
コード例 #2
0
ファイル: GameMain.py プロジェクト: gramib/BradenCannon
class GameMain:


    def __init__(self, width = 1000, height=500):

        pygame.init()

        self.width = width
        self.height = height
        self.screen = pygame.display.set_mode((self.width, self.height))
        self.running = 1
        self.clock = pygame.time.Clock()

        pygame.display.set_caption('Earth Defense')

        self.firingManager = FiringManager()
        self.gameLogicManager = GameLogicManager()
        self.alienManager = AlienManager()

    def drawLine(self,screen):
        pygame.draw.line(screen, (255, 255, 255), (200, 0), (200, 500))

    def display(self):

        self.screen.fill(0)

        self.firingManager.displayFiringObjects(self.screen)
        self.drawLine(self.screen)
        self.gameLogicManager.drawGUI(self.screen)
        self.alienManager.drawAliens(self.screen)

        pygame.display.flip()


    def mainLoop(self):
        while self.gameLogicManager.running:

            for event in pygame.event.get():
                if event.type==pygame.QUIT:
                    pygame.quit()
                    self.running = 0

            self.firingManager.update(.033)
            self.alienManager.updateAliens(.033, self.gameLogicManager, self.firingManager)

            self.display()
            self.clock.tick(30)

    def displayMessage(self):
        while True:

            for event in pygame.event.get():
                if event.type==pygame.QUIT:
                    pygame.quit()
                    self.running = 0



        self.screen.fill(0)

        self.clock.tick(30)