How programmingsis/jogo-de-pong works
Project type and purpose
• This is a local, standalone Java game—a simple Pong clone—built with object-oriented principles.
• Players control paddles via keyboard; the game engine detects collisions, updates scores, and renders graphics.
• A precompiled library (GameLib.jar) provides base classes, and the student implements Ball, Player, and Score classes.
File structure
• Top-level:
• README.md – describes the game and assignment.
• build/ – likely holds compiled artifacts.
• lib/ – contains GameLib.jar and its generated Javadoc.
• src/ – your source files and Makefile.
• src/ contains: Ball.java, Player.java, Score.java, plus a Makefile for compilation.
• lib/GameLib.jar holds core framework classes (Pong, Wall, etc.) that your code extends or uses.
README for additional insights
• The README highlights modularity and OOP design: each class has a single responsibility (ball movement, player input, scoring).
• There’s no network layer or database—everything runs in one process.
Main components and their interactions
a. Game Launcher / Main Loop
• Starts the game, enters the render–update loop, and terminates when the user exits.
b. Input Controller
• Listens for keyboard events, maps keys to Player actions (move up/down).
c. Game Model (Entities)
• Ball: position, velocity, collision logic.
• Player (Paddle): position, movement bounds.
• Score: maintains and updates each player’s points.
• Wall: boundary collision (in GameLib).
d. GameLib (External Library)
• Provides base classes (Pong, Wall, utility methods) that your entities use or subclass.
e. Renderer / View
• Draws the Ball, Paddles, Scoreboard to the screen each frame.
Relationships & Data Flow
• Input Controller → Model: on key press, calls Player.move().
• Main Loop → Model: updates Ball.move(), checks collisions.
• Model → Score: on collision behind paddle, Score.increment().
• Renderer → Display: issues graphics calls.
Architectural patterns & design principles
• Model–View–Controller (MVC) style separation:
• Model: Ball, Player, Score, Wall.
• View: rendering subsystem (Graphics2D or similar).
• Controller: keyboard input handler.
• Single Responsibility Principle: each class has one reason to change.
• Dependency on external library (GameLib.jar) for common game abstractions.
Technologies and tools
• Java SE (AWT/Swing or custom GameLib rendering).
• Makefile-driven build to compile .java into .class files under build/.
• GameLib.jar as a provided dependency.
Final checklist
• [ ] Clearly labeled components (MainLoop, InputController, Ball, Player, Score, GameLib.jar, Renderer)
• [ ] Annotations for collision handling and scoring events
• [ ] Grouping or layering that shows MVC separation