import pygame import time class Surface(pygame.Surface): def __init__(self, window_size, resources_dir, game_fps): super().__init__(window_size, pygame.SRCALPHA) self.name = 'title' self.running = True self.next_surface = None self.clock = pygame.time.Clock() self.additional_args = {} self.bg = pygame.image.load(resources_dir + '/images/bg.png').convert_alpha() self.title = pygame.image.load(resources_dir + '/images/title.png').convert_alpha() self.frames = 1 self.game_fps = game_fps self.delay = 1 def update(self): self.clock.tick(self.game_fps) self.blit(self.bg, (0, 0)) self.blit(self.title, (0, 0)) self.frames += 1 if self.frames > self.game_fps * self.delay: self.next_surface = 'egg_select' self.running = False