Compare commits

..

3 Commits

Author SHA1 Message Date
f2b6200355 docs: Add controls 2026-02-22 22:00:26 +01:00
e15d4ec874 chore: Late something 2026-02-22 21:46:12 +01:00
dac6d666b2 chore: Minor changes 2026-02-22 20:59:20 +01:00
6 changed files with 66 additions and 9 deletions

37
README.md Normal file
View File

@@ -0,0 +1,37 @@
# Terminal Game
A multiplayer terminal-based game built with Java, utilizing WebSockets for communication and Lanterna for the text-based user interface.
## Project Structure
* **game**: Client application (TUI).
* **server**: WebSocket server.
* **common**: Shared libraries and logic.
## Requirements
* Java 25
* Maven
## How to Run
1. Build the project:
```bash
mvn clean install
```
2. Start the server:
```bash
mvn compile exec:java -pl server -am
```
3. Start the client (in a new terminal):
```bash
mvn compile exec:java -pl game -am
```
## Controls
* **Left Click**: Interact with objects and fight.
* **WASD**: Move the character.
* **CTRL**: Hold to run (sprint).

View File

@@ -0,0 +1,8 @@
package cz.jzitnik.client.game.items.types;
public class BeastSkin implements ItemType<BeastSkin> {
@Override
public Class<BeastSkin> getItemType() {
return BeastSkin.class;
}
}

View File

@@ -12,7 +12,9 @@ import cz.jzitnik.client.game.items.types.weapons.Sword;
@JsonSubTypes({ @JsonSubTypes({
@JsonSubTypes.Type(value = Food.class, name = "food"), @JsonSubTypes.Type(value = Food.class, name = "food"),
@JsonSubTypes.Type(value = Sword.class, name = "weapon_sword"), @JsonSubTypes.Type(value = Sword.class, name = "weapon_sword"),
@JsonSubTypes.Type(value = Junk.class, name = "junk") @JsonSubTypes.Type(value = Junk.class, name = "junk"),
@JsonSubTypes.Type(value = Key.class, name = "key"),
@JsonSubTypes.Type(value = BeastSkin.class, name = "beast_skin"),
}) })
public interface ItemType<T> { public interface ItemType<T> {
Class<T> getItemType(); Class<T> getItemType();

View File

@@ -0,0 +1,8 @@
package cz.jzitnik.client.game.items.types;
public class Key implements ItemType<Key> {
@Override
public Class<Key> getItemType() {
return Key.class;
}
}

View File

@@ -24,6 +24,11 @@ public class GameWinHandler extends AbstractSocketEventHandler<GameWin> {
roomTaskScheduler.finalShutdown(); roomTaskScheduler.finalShutdown();
WinScene winScene = new WinScene(); WinScene winScene = new WinScene();
gameState.setScreen(winScene); gameState.setScreen(winScene);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
winScene.fullRender(); winScene.fullRender();
} }
} }

View File

@@ -75,15 +75,15 @@
answers: answers:
- answer: "I have it" - answer: "I have it"
requirement: requirement:
item: "quest_item_boss_skin" item: "BeastSkin"
dialog: dialog:
text: "Well done. Here is the key." text: "Well done. Here is the key."
onEnd: onEnd:
type: "give_item" type: "give_item"
item: item:
id: 800 id: 800
name: "Something" name: "Key"
type: { name: "junk" } type: { name: "key" }
texture: "APPLE" texture: "APPLE"
then: { type: end } then: { type: end }
- answer: "Not yet" - answer: "Not yet"
@@ -114,7 +114,7 @@
itemsDrops: itemsDrops:
- id: 200 - id: 200
name: "Beast Skin" name: "Beast Skin"
type: { name: "junk" } type: { name: "beast_skin" }
texture: "BOSS_SKIN" texture: "BOSS_SKIN"
tasks: tasks:
- type: "following_player" - type: "following_player"
@@ -137,11 +137,8 @@
- id: "final_room" - id: "final_room"
texture: "ROOM6" texture: "ROOM6"
requirement: requirement:
item: "quest_item_final_key" item: "Key"
end: true end: true
#objects:
# - objectType: "exit"
# cords: { x: 140, y: 40 }
west: null west: null
east: null east: null
north: null north: null