This project is a tower defense game which showcases object oriented programming principles and method-based programming. Project is created for my sophomore year monthly required project for Kocaeli University Computer Engineering Faculty. This project is developed using Java language and JavaFX library. The game includes three towers and three different enemies. User has a health bar and money that can use it for placing towers. The user is expected to kill enemies by placing towers that automotically shoot the enemies. The towers and eneimes are developed using two super classes. The important incidents are kept inside a text file, which is being written in runtime.
This project has a report that's been written based on the rules of IEEE Articles. If you want more information about the project, check that out.
- Goal: Prevent enemies from reaching the last tile.
- Controls: 1. Click the tower buttons on the bottom left to select a tower intended to place 2 After selecting a tower, right click to cancel the placing process. 3. Click on a desired, accessible tile to place the tower
- Game Over: Game ends if the healthbar of the user recahes to 0
- Victory: If user successfully prevail two waves of enemy attacks, game is won.
- Three enemy types: Leech, Bat, Overlord, each with unique speed, health and behavior
- Three different tower types with damage, fire rate, range, and special bullet behaviors
- Ice slow effect system that temporarily slows enemies
- Health bar system for both player and enemies
- Money manage system for tower placement and strategy
- Wave-based gameplay
- Dynamically changeable enemy pathes
- Animated movement and attacks using JavaFX Timeline & SequentialTransition
- Runtime logging system that records important in-game events
- Developed in Java using JavaFX for UI, animations and rendering
- Uses Object-Oriented Programming principles:
- Abstract super classes for Enemy and Tower
- Inheritance for specific enemy & tower types
- Path-following system for enemies using tile-coordinates converted to scene coordinates
- Collision & Hit System
- Bullets travel toward target using animation
- Damage applies on hit
- Slow effect + glow visual feedback
- Logging System
- Uses FileManage class
- Writes gameplay events into gamelog.txt
- Logs kills, enemy reaching base, player health drops, money thresholds, etc.
All important events are recorded in gamelog.txt Examples of logged events:
23:40:45 A Tower placed on: 425.0, 325.0
23:40:46 A Snowball Thrower placed on: 525.0, 275.0
23:40:48 A Laser Tower placed on: 425.0, 225.0
23:40:48 One enemy is killed after taking the damage of: 15.0
23:40:49 One bat has reached the finish lineApart from this part of te project strictly required from the professors, it is also helpful for debugging and documenting purposes.
clone the project into one of java IDEs. This project is developed in IntelliJ. Make sure you have the JavaFX library installed.
https://github.com/toprkates/TowerGame.git- JDK 17+ (preferably)
- JavaFX SDK installed and configured
- An IDE like IntelliJ IDEA or Eclipse
Run Game.java
TowerDefense/
│
├── src/
│ └── org.example.towerproject/
│ │
│ ├── base/ # Abstract & core gameplay classes
│ │ ├── Enemy.java
│ │ ├── Tower.java
│ │ ├── Bullet.java
│ │ └── Tile.java
│ │
│ ├── enemies/ # Enemy implementations
│ │ ├── Leech.java
│ │ ├── Bat.java
│ │ └── Overlord.java
│ │
│ ├── towers/ # Tower implementations
│ │ ├── LaserTower.java
│ │ ├── CanonTower.java
│ │ └── SnowballThrower.java
│ │
│ ├── scenes/ # All UI Scenes & Controllers
│ │ ├── startmenu/
│ │ ├── settings/
│ │ ├── playthrough/
│ │ └── endmenu/
│ │
│ ├── game/ # Core game running / player logic
│ │ ├── Game.java
│ │ └── Gamer.java
│ │
│ ├── filemanage/ # Runtime logging system
│ │ └── FileManage.java
│ │
│ ├── Path.java # Path data
│ └── TileCoord.java # Tile coordinate mapping
│
├── resources/ # Images, FXML, assets
│ ├── scenes/
│ ├── towers/
│ ├── enemies/
│ └── buildings/
│
├── gamelog.txt # Runtime game log
├── README.md
└── (IDE & config files)
