Skip to content

joaopgamarques/POO-Project-Rogue

Repository files navigation

Rogue — A Dungeon Crawler Game

A roguelike dungeon crawler built in Java using the ISCTE GraphPack GUI framework. Navigate through interconnected rooms, fight enemies, collect items, and aim for the highest score.

Developed for the Object-Oriented Programming (POO) course at ISCTE.

Gameplay

  • Explore rooms on a 10x10 tile grid, moving the hero with arrow keys
  • Fight enemies (Skeletons, Bats, Thugs, Scorpions, Thieves) in turn-based combat
  • Collect items — swords, armor, healing potions, keys, and treasure
  • Unlock doors with matching keys to progress between rooms
  • Manage a 3-slot inventory: drop items (1/2/3) or use them (Q/W/E)
  • Save & Load your progress at any point
  • Hall of Fame — top 5 scores are persisted across sessions

Architecture

src/pt/iscte/poo/example/
│
├── Engine.java # Game loop, input handling, turn management (Singleton + Observer)
├── Level.java # Room loading from text files, element tracking, save/load
├── Main.java # Entry point
│
├── GameElement.java # Abstract base — position + ImageTile implementation
│ ├── Entity.java # Abstract — HP, attack, movement, collision, pathfinding
│ │ ├── Hero.java # Player character — inventory, interactions, poison, save state
│ │ ├── Skeleton.java # Enemy type
│ │ ├── Bat.java # Enemy type
│ │ ├── Thug.java # Enemy type
│ │ ├── Scorpio.java # Enemy type
│ │ └── Thief.java # Enemy type
│ ├── Item.java # Abstract — collect, use, drop, factory method
│ │ ├── Sword.java # Increases attack power
│ │ ├── Armor.java # Chance to block damage
│ │ ├── HealingPotion.java # Restores HP and cures poison
│ │ ├── Key.java # Unlocks matching doors
│ │ └── Treasure.java # Score bonus
│ ├── Door.java # Open/closed state, links rooms, optional key requirement
│ ├── Wall.java # Impassable terrain
│ └── Floor.java # Walkable terrain
│
├── Inventory.java # 3-slot item management with GUI rendering (Singleton)
├── HealthBar.java # Visual HP display
├── HallOfFame.java # Top 5 leaderboard with file persistence (Singleton)
│
├── Interactable.java # Interface — interactsWith(GameElement)
├── Movable.java # Interface — move(Direction...), extends Interactable
├── Collectable.java # Interface — collect(), use(), drop(), extends Interactable
└── Enemy.java # Marker interface for enemy identification

Design Patterns

  • SingletonEngine, Inventory, and HallOfFame ensure single instances
  • ObserverEngine observes GUI keyboard events via the GraphPack Observer interface
  • Factory MethodEntity.create() and Item.create() instantiate concrete types from room file data
  • Marker InterfaceEnemy tags enemy entities for filtering without adding methods

Room Files

Levels are defined as text files in rooms/. Each file contains:

  1. A 10x10 ASCII grid (# = wall, space = floor)
  2. Entity/item/door definitions with position and parameters
##########
#
#
#
Skeleton,1,6
Bat,3,7
Sword,8,8
Key,8,2,KEY0
Door,9,4,room2,0,4,KEY2
Door,4,9,room1,4,0,KEY0

Controls

Key Action
Arrow keys Move hero
1 / 2 / 3 Drop inventory slot
Q / W / E Use inventory slot

Prerequisites

  • Java 8+
  • GraphPack library (included in GraphPack_2022_2023_V1_1/)

Running

Compile and run Main.java with the GraphPack source on the classpath:

javac -cp "GraphPack_2022_2023_V1_1/src" Rogue_Joao_105377_Tiago_105475/src/pt/iscte/poo/example/*.java
java -cp "GraphPack_2022_2023_V1_1/src:Rogue_Joao_105377_Tiago_105475/src" pt.iscte.poo.example.Main

Or open the project in IntelliJ IDEA (project files included).

Authors

  • Joao Marques
  • Tiago Lobo

About

Projeto desenvolvido no âmbito da unidade curricular de Programação Orientada a Objetos.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages