How tejon-company/tejon-jumper works
Project’s Type and Purpose
• This project is a 2D platformer video game built in Python.
• It’s structured as a game application with distinct components for asset management, game scenes (levels and UI), game logic (like physics and interactions), and sprites (characters, enemies, projectiles, environments).
• The README makes it clear that the game has multiple levels, in-game menus, and utilizes different assets (graphics, sounds, level files) organized in the file tree.
Main Components
a. Core Engine & Game Loop – Centered around src/main.py.
b. Resource Management – src/resource_manager.py which likely handles asset loading (graphics, audio, and tilemaps).
c. Scenes & Levels – The “src/scene” folder includes background, camera, level, game over screen, and UI subcomponents (HUD, menus like main, pause, settings, victory). These represent different game states and transitions.
d. Singletons and Game Management – Located in src/singletons (director, game, settings modules). They play a critical role in coordinating the game flow and maintaining global settings (like resolution, difficulty).
e. Sprites – Managed in src/sprites, with separate directories for berries, characters (players, enemies split into multiple types), the environment, and projectiles. This separation defines the visual and behavioral components.
f. Assets – The assets folder (with subdirectories for different resolutions and media types) which is used to supply backgrounds, sprite sheets, tiled maps, and sound effects/music.
Relationships and Interactions
• The main game loop (src/main.py) initializes the game and loads the required resources via the Resource Manager.
• The Resource Manager interacts with the files in the assets directory to load graphics, sounds, and tile maps.
• Game scenes (like level, game over, and menus) transition between each other under the coordination of the Director and other Singleton managers.
• Within scenes, game objects (sprites) are managed and updated. Sprites (players, enemies, projectiles, etc.) communicate with scene utilities (such as collision and animation utilities) for interactions.
• Singletons (director, game, settings) provide a global point of control to manage state and configuration, thereby bridging requests from the input (e.g., from the control handlers in the scene modules) to the game logic and resource management.
Architectural Patterns & Design Principles Highlighted
• Modularity: Clear separation between scenes, resource handling, and sprite management.
• Singleton Pattern: Used in the src/singletons folder for global game controllers and settings.
• Layering: Different layers for game assets (visual and sound), logic (scenes and main loop), and data (configuration/settings).
• Game Initialization (main.py) at the top.
• Core Modules:
• Resource Manager
• Singleton Controllers (Director, Game, Settings)
• Main Game Loop
• Game Scenes:
• Background, Camera, Level, Game Over
• UI Components (HUD, Main Menu, Pause Menu, Settings Menu, Victory Menu)
• Sprites:
• Characters (Player, Enemies – categorized by enemy type)
• Berries (and associated factories)
• Environment Elements
• Projectiles (with pooling support)
• Asset Management:
• Graphics (sprite sheets, backgrounds, tiled maps)
• Audio (music, sound effects)