Skip to content

This is my custom-made 2D implementation of the popular "Tower Defense" game, developed using Java language and the JavaFX framework. It features strategic tower placement. 🏰

Notifications You must be signed in to change notification settings

YoC00lig/Tower-Defense

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⭐️ Tower defense ⭐️

A simple game whose goal is to defend the castle from the incoming waves of enemies. The player can defend the castle by placing towers that deal damage to enemies and building walls that temporarily distract the enemy from the target (castle). Unfortunately, enemies can destroy any object.

There are two types of towers in the game. They differ primarily in attack range and durability and therefore in price. During the game, you can increase the tower's attack range or sell it. Its price will of course depend on its condition - a tower that has been attacked by an enemy will no longer have its maximum value.

The player can also build a wall. The wall does not attack the enemy, but temporarily stops them. The enemy stands against the wall that stands in his way and destroys it until he can go through it. This gives you extra time to think about your game strategy.

You can see different types of enemies. They differ in the maximum health and strength. If the tower kills an enemy, you will receive money - the amount depends on the type of enemy. Enemies are a bit lazy - they always look for the nearest object and choose the shortest path to it.

The castle is the most important object in the game. It stands in the center of the map and is the target of enemy attacks. The castle has a health bar, and when it is empty, the game is over. You can recharge its health bar to the maximum at any time - but it's not cheap.

🗺 You can choose different variants of the map:

⚙️ Basic - you can only place towers and walls.

🌊 Flood - in addition, there are inaccessible places flooded by water on the map.

✨ Extended - you can increase castle health bar, sell and upgrade towers.

🛠 Core technology stack:

  • Java 17
  • Gradle
  • JavaFX
  • The icons have been sourced from here.

🎮 Let's begin!

After starting the game, the following window will be displayed:

After pressing START GAME button you can choose a map variant (don't forget to enter your nickname - without it the game won't start).

❓ How to place objects?

Tower

It's easy. You have to click anywhere on the map (it will be the upper left corner of the tower). Then the shop window will be displayed. Click the BUY button under the selected tower. If you do not have enough money, you will see the appropriate message.

Wall

It's a little more complicated. You also need to click anywhere on the map - this will be the beginning of the wall. In the shop window, select the wall and click BUY. When the shop window disappears, click anywhere on the map again - this time it will be the end of the wall. When you don't have enough money, only part of the wall will be built.

First objects

At the beginning, you have a certain amount of money to spend. Place your first objects, then press the PLAY button to start the game. Remember that objects cannot overlap and cannot extend beyond map bounds.

⬆️ Upgrade objects

You can upgrade your objects during the game. To do this, click on the object you want to improve.

🏁 End of the game

The game ends when the castle is destroyed or the player defeats all waves of enemies. At the end of the game, a window with information and statistics is displayed. You can see your score and top three scores in the game, quit game or play again.

About

This is my custom-made 2D implementation of the popular "Tower Defense" game, developed using Java language and the JavaFX framework. It features strategic tower placement. 🏰

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages