How noluca/tower-defence works
Project type and purpose
• This is a desktop “Tower Defence” game built entirely in Processing (Java-based).
• Purpose: render a game loop, accept user input to place towers, spawn and move enemy units along a path, track lives, and end the game when lives reach zero.
File structure
• Top-level PDE files correspond to key classes/modules:
• Main.pde: application entry point and game loop
• Menu.pde: main menu UI
• Griglia.pde: grid on which you place towers
• Bottone.pde & Cliccabile.pde: button and clickable UI abstractions
• Nemico*.pde: enemy classes (Nemico, NemicoVeloce)
• NemicoManager.pde: enemy spawn and lifecycle management
• Percorso.pde & Punto.pde: path and waypoint management
• sketch.properties and sketch_250123a.pde are Processing configuration files.
• README.md describes gameplay and links to a UML PDF.
README for additional insights
• Gameplay loop: spawn red-square enemies → they move along the path → if they reach the goal, decrement player lives → game over at zero lives.
• Right-click places blue-square towers on the grid.
a. Main components
1. Processing Runtime (game engine)
2. Input Handler (mouse events)
3. UI Layer
• Menu Screen
• Grid & Buttons
4. Game State Manager (Main)
5. Entity Layer
• Towers (clickable grid cells)
• Enemies (Nemico, NemicoVeloce)
6. EnemyManager (spawn logic & lifecycle)
7. Pathing Module (Percorso & Punto)
8. Rendering Subsystem
9. Collision/Range Checking
10. Score/Lives Tracker
b. Relationships and Interactions
• Input Handler listens for mouse clicks and forwards “build tower” events to Game State Manager.
• Game State Manager updates EnemyManager, Towers, and LivesTracker.
• EnemyManager references the Pathing Module to move each Nemico along Percorso’s Punto list.
• Rendering Subsystem draws UI Layer, Grid, Towers, and Enemies in each frame.
• Collision/Range Checking: Towers query Enemy positions each update to decide when to shoot (if implemented).
c. Architectural patterns/design principles
• Single-threaded, event-driven architecture
• Manager pattern for grouping dynamic entities (EnemyManager)
• Separation of concerns: UI components vs. game logic vs. pathfinding
d. Key technologies/frameworks
• Processing (Java-based sketch environment)
• PDE file modules serve as classes
• UML for static class relationships
Essential details not to omit
• Interaction points: input → UI → game state.
• Entity relationships: EnemyManager holds Nemico instances; Path holds Punto waypoints.
• Rendering is invoked each frame for all active entities.