This project is an implementation of the classic Arknoid (also known as breakout) game in Java. Players control a paddle to bounce balls and break blocks, earning points for each block destroyed.
Note: The demo speed is 1.75x the normal game speed.
- Java Runtime Environment (JRE) 8 or above
- Apache Ant
# Using HTTPS
git clone https://github.com/nav1s/arknoid.git
# OR using SSH
git clone [email protected]:nav1s/arknoid.git
cd arknoid/com.game
ant run
- Left Arrow: Move paddle left
- Right Arrow: Move paddle right
- Control the paddle to prevent balls from falling off the bottom of the screen
- Break all the blocks to win the game
- If all balls are lost, the game ends
- Earn 5 points for each block destroyed
The game follows an object-oriented design with several key components:
- Game: Manages the game loop, initialization, and main logic
- Sprites: Visual elements that can be drawn and animated
- Collidables: Objects that can be collided with
- Listeners: Components that respond to game events
- GameEnvironment: Manages collision detection between objects
Collision detection uses geometric calculations to determine:
- The point of impact between objects
- The appropriate velocity changes after collision
- Special interactions like angle changes based on paddle position
The game implements a listener pattern for events:
- HitListener: Interface for objects that respond to collision events
- ScoreTrackingListener: Updates score when blocks are hit
- BlockRemover: Removes blocks when they're hit
- BallRemover: Removes balls when they fall off the screen
- geometry: Contains classes for geometric calculations (Point, Line, Rectangle, Velocity)
- sprites: Visual game objects (Ball, Block, Paddle, ScoreIndicator)
- utils: Core game utilities (Game, GameEnvironment, Collidable)
- listeners: Event handling interfaces and implementations
- collections: Container classes for managing groups of objects
- Game: Main class responsible for initialization and running the game loop
- Ball: Represents the balls that bounce around the screen
- Block: Represents breakable and boundary blocks
- Paddle: The player-controlled element
- ScoreIndicator: Displays the current score