A 2D tank game developed in Java using JavaFX to demonstrate OOP design principles. Players control a tank to battle against AI-controlled tanks. The game features smooth movement, collision detection, AI opponents, power-ups, and various obstacles.
- Player-Controlled Tank: Navigate through the battlefield and engage enemy tanks.
- AI-Tanks: AI opponents that track and attack the player and allied tanks.
- Obstacle Interaction: Walls and obstacles that tanks and missiles cannot pass through.
- Power-Ups: Collectible items like medpacks to restore currentHealth.
- Collision Detection: Collision handling between tanks, obstacles, missiles, and power ups.
Up: Up Arrow Key
Down: Down Arrow Key
Left: Left Arrow Key
Right: Right Arrow Key
Space: Fire Missile (has a cooldown)
To run this project, you need:
- Java Runtime Environment (JRE) or Java Development Kit(JDK) 21 or higher
- Download the JAR file.
Get the latest version of
TankGame.jar
from the Releases page. - Navigate to the directory where TankGame.jar is located.
- If using terminal/command prompt, execute the following:
java -jar TankGame.jar
Notes:
- Ensure that
java
is accessible in your system's PATH if you're using the terminal/command prompt.
Key Components
- GameObject: Ensures consistent behavior across all game entities, such as tanks, walls, and powerups.
- GameObjectManager: Oversees the game logic, manages the state of game objects, and handles overall game flow.
- GameObjectFactory: Responsible for the creation of all gameObjects.
- TankController: Allows user input to interact with playerTank movement.