Kingslayer is a text-based dungeon crawler written in Rust. It is a rewrite and continuation of thekinggame.
You can find the WASM package at github.com/Maxgy/kingslayer-wasm
You can play the online WASM version here: maxgy.github.io/kingslayer-wasm
or clone the project and run:
$ cargo run --release
Worlds are defined with JSON. An example can be found on the wiki. Deploying the world to the command line looks like this: ```rust use kingslayer::Cli;
fn main() { let cli = Cli::fromjsonfile("data/world.json");
cli.start();
}
or the loop can be managed manually like this:
rust
use kingslayer::Cli;
fn main() { let cli = Cli::fromjsonfile("data/world.json");
println!("{}", cli.ask("l"));
loop {
let s = cli.ask(&Cli::prompt());
println!("{}", s);
if s.contains("You died.") {
break;
}
}
}
``
This method allows you to manage other forms of input and output such as within a website. The JSON content for the world can also be passed as a raw string with
Cli::fromjsonstr`.