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 ###
评论列表
文章目录