189 lines
3.2 KiB
Markdown
189 lines
3.2 KiB
Markdown
# ⚔️ Java Knight RPG
|
|
|
|
## 🎮 Introduction
|
|
Java Knight is a text-based RPG game developed in Java using Object-Oriented Programming principles.
|
|
The player explores different locations, fights enemies, collects keys, gains experience, and becomes stronger throughout the adventure.
|
|
Each enemy has unique abilities, and the final goal is to defeat the Dragon Boss and complete the quest.
|
|
|
|
---
|
|
|
|
# 🛠️ Compile & Run
|
|
|
|
## ✅ Compile
|
|
Open the terminal in the project folder and run:
|
|
|
|
```bash
|
|
javac *.java
|
|
```
|
|
|
|
## ▶️ Run
|
|
After compiling, start the game using:
|
|
|
|
```bash
|
|
java Main
|
|
```
|
|
|
|
---
|
|
|
|
# 🧩 Classes & OOP Design
|
|
|
|
## 🧱 Entity
|
|
The base class of all living characters in the game.
|
|
It contains common attributes such as:
|
|
- Name
|
|
- Health
|
|
- Damage
|
|
- Defense
|
|
|
|
This class demonstrates:
|
|
- Inheritance
|
|
- Encapsulation
|
|
|
|
---
|
|
|
|
## 🛡️ Player
|
|
Represents the main playable character.
|
|
The player can:
|
|
- Fight enemies
|
|
- Gain XP
|
|
- Level up
|
|
- Collect keys
|
|
- Move between locations
|
|
|
|
Concepts used:
|
|
- Encapsulation
|
|
- Method overriding
|
|
- State management
|
|
|
|
---
|
|
|
|
## ⚔️ Knight
|
|
A specialized version of the Player class with stronger combat abilities and better starting stats.
|
|
|
|
Concepts used:
|
|
- Inheritance
|
|
- Polymorphism
|
|
|
|
---
|
|
|
|
## 👾 Enemy
|
|
Base class for all enemy types in the game.
|
|
Defines common enemy behavior such as:
|
|
- Attacking
|
|
- Taking damage
|
|
- Health management
|
|
|
|
Concepts used:
|
|
- Abstraction
|
|
- Inheritance
|
|
|
|
---
|
|
|
|
## 💀 Skeleton
|
|
A simple enemy with balanced combat stats.
|
|
|
|
---
|
|
|
|
## 👹 Goblin
|
|
A fast enemy with a chance to deal critical damage.
|
|
|
|
---
|
|
|
|
## 🧛 Vampire
|
|
An enemy capable of stealing health from the player during combat.
|
|
|
|
---
|
|
|
|
## 🐉 Dragon
|
|
The final boss of the game with powerful attacks that can ignore defense.
|
|
|
|
---
|
|
|
|
## 📍 Location
|
|
Handles the world map and movement system.
|
|
Each location contains:
|
|
- Enemies
|
|
- Connected locations
|
|
- Exploration logic
|
|
|
|
Concepts used:
|
|
- Object relationships
|
|
- Composition
|
|
|
|
---
|
|
|
|
## 🎒 Item
|
|
Represents collectible and usable objects inside the game.
|
|
Items can help the player by:
|
|
- Restoring health
|
|
- Increasing power
|
|
- Supporting progression
|
|
|
|
Concepts used:
|
|
- Encapsulation
|
|
- Object interaction
|
|
|
|
---
|
|
|
|
# 🧠 OOP Principles Used
|
|
|
|
- ✅ Inheritance
|
|
- ✅ Encapsulation
|
|
- ✅ Polymorphism
|
|
- ✅ Abstraction
|
|
|
|
The project is fully designed using Object-Oriented Programming to make the code modular, reusable, and easier to maintain.
|
|
|
|
---
|
|
|
|
# 🎯 How to Play
|
|
|
|
## 🎮 Controls
|
|
The game is menu-based.
|
|
Players select actions by entering numbers in the terminal.
|
|
|
|
Example actions:
|
|
- Attack enemy
|
|
- View stats
|
|
- Move to another location
|
|
- Continue exploration
|
|
|
|
---
|
|
|
|
## 📊 Player Stats
|
|
|
|
### ❤️ Health
|
|
Determines how much damage the player can survive.
|
|
|
|
### ⚔️ Damage
|
|
Controls attack power against enemies.
|
|
|
|
### 🛡️ Defense
|
|
Reduces incoming damage.
|
|
|
|
### ✨ XP
|
|
Earned after defeating enemies and used for leveling up.
|
|
|
|
### 🔑 Keys
|
|
Required to unlock progression and reach the final boss.
|
|
|
|
---
|
|
|
|
## 🌍 Gameplay Flow
|
|
|
|
1. Start the game
|
|
2. Explore locations
|
|
3. Fight enemies
|
|
4. Gain XP and level up
|
|
5. Collect keys
|
|
6. Reach the Dragon Castle
|
|
7. Defeat the Dragon Boss
|
|
|
|
---
|
|
|
|
# 👩💻 Credits
|
|
|
|
Developed with Java and Object-Oriented Programming concepts.
|
|
|
|
Made by Romina
|