added docstrings to every file and function. (with claude, checked it)

tower and game_play dont meet pylint check yet.
This commit is contained in:
2026-07-15 22:16:18 +02:00
parent 367a839c8a
commit 821aa2e8a4
9 changed files with 428 additions and 109 deletions
+30 -5
View File
@@ -1,23 +1,48 @@
"""Base screen module - shared interface for all game screens."""
class BaseScreen:
"""Abstract base class defining the interface for all game screens.
Subclasses override :meth:`process_event`, :meth:`update`, and :meth:`draw`
to implement screen-specific behaviour. UI elements added to ``self.elements``
are shown and hidden automatically when the screen is switched.
Attributes:
game (Game): The central game instance.
elements (list): pygame_gui elements managed by this screen.
"""
def __init__(self, game):
self.game = game
self.elements = []
def process_event(self, event):
pass
"""Handle a single pygame event.
Args:
event (pygame.event.Event): The event to process.
"""
def update(self, dt):
pass
"""Update screen state for the current frame.
Args:
dt (float): Time elapsed since the last frame in seconds.
"""
def draw(self, surface):
pass
"""Draw the screen onto the given surface.
Args:
surface (pygame.Surface): Target surface to draw onto.
"""
def show(self):
"""Make all UI elements on this screen visible."""
for element in self.elements:
element.show()
def hide(self):
"""Hide all UI elements on this screen."""
for element in self.elements:
element.hide()
element.hide()