37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
"""Title screen module. Contains the surface object to be rendered on the screen."""
|
|
import pygame
|
|
from pocket_friends.elements import surface
|
|
|
|
|
|
class Surface(surface.GameSurface):
|
|
"""
|
|
Surface object for the title screen.
|
|
"""
|
|
def __init__(self, game_res, resources_dir, game_fps):
|
|
"""
|
|
Create a title screen surface object
|
|
Args:
|
|
game_res (int): The internal resolution of the game
|
|
resources_dir (str): The full path of the game's resource directory
|
|
game_fps (int): The
|
|
"""
|
|
|
|
super().__init__(game_res, resources_dir, game_fps)
|
|
|
|
self._frames = 0
|
|
self._delay = 1
|
|
|
|
self._title = pygame.image.load(resources_dir + '/images/title.png').convert_alpha()
|
|
|
|
def update(self):
|
|
"""
|
|
Advance the surface logic by one frame.
|
|
"""
|
|
self.preprocess()
|
|
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
|