You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
from .. components import info
|
|
|
|
import pygame
|
|
|
|
|
|
|
|
class LoadScreen:
|
|
|
|
def start(self,game_info):
|
|
|
|
self.game_info = game_info
|
|
|
|
self.finished = False
|
|
|
|
self.next = 'level'
|
|
|
|
self.duration = 2000 # 持续时间
|
|
|
|
self.timer = 0
|
|
|
|
self.info = info.Info('load_screen',self.game_info)
|
|
|
|
|
|
|
|
def update(self,surface,keys):
|
|
|
|
self.draw(surface)
|
|
|
|
if self.timer == 0:
|
|
|
|
self.timer = pygame.time.get_ticks() # 如果初始时间为零改为当前时间
|
|
|
|
elif pygame.time.get_ticks() - self.timer > 2000:
|
|
|
|
self.finished = True
|
|
|
|
self.timer = 0
|
|
|
|
|
|
|
|
def draw(self,surface):
|
|
|
|
surface.fill((0,0,0))
|
|
|
|
self.info.draw(surface)
|
|
|
|
|
|
|
|
class GameOver(LoadScreen):
|
|
|
|
def start(self,game_info):
|
|
|
|
self.game_info = game_info
|
|
|
|
self.finished = False
|
|
|
|
self.next = 'main_menu'
|
|
|
|
self.duration = 4000
|
|
|
|
self.timer = 0
|
|
|
|
self.info = info.Info('game.over',self.game_info)
|