engine.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:Akkers2Beurs 作者: RensBoeser 项目源码 文件源码
def Loop(self): # game loop
        while not self.Exit:

            if self.Level == "menu": # loop only goes here if the level is 'menu'
                for event in pygame.event.get(): # checking for any events

                    if event.type == pygame.QUIT: # checks if someone tries to close the window
                        self.Exit = True # stops the while-loop
                    if event.type == pygame.KEYDOWN:
                        if event.key == pygame.K_ESCAPE:
                            self.Exit = True

                self.Draw() # black screen. draw all your things after this line

                grid.Draw()
                player1.Draw()
                player2.Draw()

                self.Tick() # refreshes the window. this is the end of the loop

            # you can use elifs here to make new levels

            else: self.Exit = True # if self.Level is not a valid level, it will terminate the while-loop

### FUNCTION DEFINITIONS ###
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号