整理
This commit is contained in:
parent
c967c56c54
commit
ecd511495d
6
main.py
6
main.py
@ -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()
|
||||||
|
|||||||
@ -639,4 +639,4 @@ CHOOSE = 'choose'
|
|||||||
PLAY = 'play'
|
PLAY = 'play'
|
||||||
|
|
||||||
# 无穷大常量
|
# 无穷大常量
|
||||||
INF = float("inf")
|
INF = float("inf") # python传递字符串性能较低,故在这里对inf声明一次,以后仅需调用即可
|
||||||
|
|||||||
@ -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:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user