How m-dudash/perfidia works
• Game Engine / Main Loop:
– Represented by main.py and the central “Game” class.
– This module controls the game cycle, state transitions (from start screen to levels to cutscenes) and orchestrates other subsystems.
• Level Manager:
– The Level class (in level.py) is responsible for loading TMX map files from the assets/map folder, managing tiles, enemy spawn points, backgrounds, and the parallax effect.
• UI & Screen Components:
– Include StartScreen (start_screen.py), HellScreen (hell_screen.py), and Cutscene (cutscene.py) modules.
– These components manage menus, introductory screens, cutscenes (like the final sequence at the ninth circle), and debug transitions (e.g., switching levels with TAB).
• Game Entities:
– Player (player.py), Enemy (enemy.py), and Fire (fire.py) classes are central to the gameplay.
– Additionally, CorruptionBar (corruption_bar.py) and HealthBar (health_bar.py) represent the in-game status displays.
• Asset Manager:
– Although not explicitly a class, the assets folder (with subfolders for audio, backgrounds, enemy sprites, etc.) indicates the resource management piece.
• Audio Manager:
– Conceptually group the audio assets (both music and sound effects) and note that sound management logic (likely integrated within the Game or individual modules) loads audio files (from assets/audio) based upon context (level beginnings, actions, transitions).
Relationships & Data Flow
• The Game Engine calls the Level Manager to load a level, which in turn loads the appropriate map (TMX files) and associated assets (backgrounds, enemy spawn points).
• The Player, Enemy, and Fire modules interact with the Level object for collisions, physics, and triggering game logic (damage, movement, etc.).
• UI components (StartScreen, HellScreen) communicate with the Game Engine to trigger state changes and update on-screen elements.
• The Asset Manager supplies visual and audio resources to entities, levels, and UI components.
• The Audio Manager receives triggers from state changes or events (e.g., player attack, enemy death) and plays the corresponding sounds from the assets.
Architectural Patterns & Design Principles
• Modularity: The project is subdivided by functionality (each game entity and system has its own module) making it easier to maintain and update.
• Separation of Concerns: There’s a clear division between game logic (Player, Enemy, Level), UI management (Start/Cut/Hell screens, bars), and resource management (assets for graphics and audio).
• Event-Driven & Update Loop: The main game loop continuously updates entities and listens for input, which is a common pattern in game development using Pygame.