This commit is contained in:
星外之神 2022-06-09 11:06:39 +08:00
parent c967c56c54
commit ecd511495d
3 changed files with 5 additions and 5 deletions

View File

@ -7,10 +7,10 @@ from source.state import mainmenu, screen, level
if __name__=='__main__': if __name__=='__main__':
# 控制状态机运行 # 控制状态机运行
game = tool.Control() game = tool.Control()
state_dict = { c.MAIN_MENU: mainmenu.Menu(), state_dict = { c.MAIN_MENU: mainmenu.Menu(),
c.GAME_VICTORY: screen.GameVictoryScreen(), c.GAME_VICTORY: screen.GameVictoryScreen(),
c.GAME_LOSE: screen.GameLoseScreen(), c.GAME_LOSE: screen.GameLoseScreen(),
c.LEVEL: level.Level() c.LEVEL: level.Level()
} }
game.setup_states(state_dict, c.MAIN_MENU) game.setup_states(state_dict, c.MAIN_MENU)
game.run() game.run()

View File

@ -639,4 +639,4 @@ CHOOSE = 'choose'
PLAY = 'play' PLAY = 'play'
# 无穷大常量 # 无穷大常量
INF = float("inf") INF = float("inf") # python传递字符串性能较低故在这里对inf声明一次以后仅需调用即可

View File

@ -30,7 +30,7 @@ class Screen(tool.State):
self.rect.y = 0 self.rect.y = 0
def update(self, surface, current_time, mouse_pos, mouse_click): def update(self, surface, current_time, mouse_pos, mouse_click):
if(current_time - self.start_time) < self.end_time: if (current_time - self.start_time) < self.end_time:
surface.fill(c.WHITE) surface.fill(c.WHITE)
surface.blit(self.image, self.rect) surface.blit(self.image, self.rect)
else: else: