Files
HW-04-JAVA-KNIGHT/README.md
T

2.0 KiB

Java Knight - Turn-Based RPG Game

Project Overview

This project is a simple turn-based RPG game written in Java.
The player can choose a character and fight different enemies such as Skeletons, Goblins, Vampires, and a final Dragon boss.

The game focuses on basic object-oriented programming concepts like inheritance, abstraction, and interfaces.


Features

  • Choose between different character classes:

    • Knight
    • Assassin
    • Wizard
  • Turn-based combat system

  • Different enemy types with unique behaviors

  • HP and MP system for player and enemies

  • Weapon and armor system

  • Experience points (XP) and leveling up

  • Special abilities for each character

  • Simple map progression (Village, Forest, Castle)


Game Mechanics

Combat System

Each turn, the player can choose one action:

  • Light Attack (no MP cost)
  • Heavy Attack (uses MP)
  • Defend (reduces incoming damage)
  • Heal (restores HP but uses MP)
  • Special Ability (strong attack with MP cost)

Enemies also attack automatically after the player's turn.


Level System

  • Players gain XP after defeating enemies
  • After reaching a certain XP threshold, the player levels up
  • Leveling up increases HP and MP

Items System

  • Weapons increase attack power
  • Armor reduces incoming damage and can break after repeated use
  • Keys are collected by defeating specific enemies

Object-Oriented Design

This project uses basic OOP principles:

  • Encapsulation: All player stats are private with getters/setters
  • Inheritance: Different player classes extend the base Player class
  • Polymorphism: Enemies and players share the Entity interface
  • Abstraction: Abstract Player class defines shared behavior

Conclusion

In this project, I was able to build a simple text-based RPG game using basic Java concepts such as classes, inheritance, and interfaces. Through this project, I learned how different game mechanics like combat, leveling up, and inventory systems can be implemented using object-oriented programming.