Crates.io | kingslayer |
lib.rs | kingslayer |
version | 0.5.5 |
source | src |
created_at | 2019-03-10 22:03:32.586652 |
updated_at | 2022-03-18 20:43:50.996776 |
description | A text adventure dungeon crawler game written in Rust |
homepage | |
repository | https://github.com/Zaechus/kingslayer |
max_upload_size | |
id | 119937 |
size | 142,056 |
Kingslayer is a text-based dungeon crawler written in Rust. It is a continuation of thekinggame.
You can play an online WASM version here: zaechus.github.io/kingslayer-web
You can also install Kingslayer:
cargo install kingslayer
kingslayer
or clone the project and run it:
cargo run --release
Worlds can be created with RON and Rust helper functions. Running the world on the command line looks like this:
use kingslayer::Cli;
fn main() {
let cli = Cli::from_file("worlds/world.ron");
cli.start();
}
or the loop can be managed manually like this:
use kingslayer::Cli;
fn main() {
let cli = Cli::from_file("worlds/world.ron");
println!("{}", cli.ask("l"));
loop {
let s = cli.ask(&Cli::prompt());
println!("{}", s);
if s.contains("Farewell.") {
break;
}
}
}
This method allows for other forms of input and output such as within a website. The content for the world can also be passed as a raw string with Cli::from_ron_str
.