updated docstrings and comments

This commit is contained in:
2023-05-15 01:04:45 -04:00
parent 9fd2bc03df
commit 8675caaca6
4 changed files with 31 additions and 15 deletions

View File

@@ -7,7 +7,22 @@ from pocket_friends.elements import surface
class Surface(surface.GameSurface):
def __init__(self, game_res, resources_dir, game_fps, **kwargs):
"""
Surface object for the selection info screen. Contains the selected egg, egg properties, and description in a
scrollable text box. Child class of surface.GameSurface.
"""
def __init__(self, game_res: tuple, resources_dir: str, game_fps: int, **kwargs: str):
"""
Create a selection info surface object.
Args:
game_res: The internal resolution of the surface.
resources_dir: The path of the game's main resource directory.
game_fps: How many frames per second the game will run at.
Keyword Args:
selected_egg: The egg that was selected by the previous screen.
"""
super().__init__(game_res, resources_dir, game_fps)
self._selected_egg = None
@@ -25,7 +40,7 @@ class Surface(surface.GameSurface):
def update(self):
"""
Advance the surface logic by one frame.
Draw objects on the screen and advance the surface logic by one frame; Handle user input.
"""
self.preprocess()
@@ -35,10 +50,8 @@ class Surface(surface.GameSurface):
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_DOWN:
# Scroll down on the info screen.
self._info_text.scroll_down()
if event.key == pygame.K_UP:
# Scroll up on the info screen.
self._info_text.scroll_up()
if event.key == pygame.K_a:
self.running = False

View File

@@ -5,22 +5,23 @@ from pocket_friends.elements import surface
class Surface(surface.GameSurface):
"""
Surface object for the title screen.
Surface object for the title screen. Child class of surface.GameSurface.
"""
def __init__(self, game_res: tuple, resources_dir: str, game_fps: int):
"""
Create a title screen surface object
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
game_res: The internal resolution of the surface.
resources_dir: The path of the game's main resource directory.
game_fps: How many frames per second the game will run at.
"""
super().__init__(game_res, resources_dir, game_fps)
self._frames = 0
self._delay = 1
self._frames = 0 # Counter for the number of frames passed
self._delay = 1 # Delay in seconds that the title should stay on screen
# Image of the title screen
self._title = pygame.image.load(resources_dir + '/images/title.png').convert_alpha()
def update(self):