Skip to content

Latest commit

 

History

History
60 lines (46 loc) · 1.84 KB

README.md

File metadata and controls

60 lines (46 loc) · 1.84 KB

👑 Kingslayer ⚔️

Current Crates.io Version Kingslayer documentation Build Status Build status

Kingslayer is a text-based dungeon crawler written in Rust. It is a continuation of thekinggame.

You can find the WASM package at github.com/Maxgy/kingslayer-wasm

Running the game

You can play the online WASM version here: maxgy.github.io/kingslayer-wasm

or clone the project and run:

$ cargo run --release

Creating and Running your own World

Worlds can be created with RON or JSON. Running the world on the command line looks like this:

use kingslayer::Cli;

fn main() {
    let cli = Cli::from_ron_file("data/world.ron");

    cli.start();
}

or the loop can be managed manually like this:

use kingslayer::Cli;

fn main() {
    let cli = Cli::from_ron_file("data/world.ron");

    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 content for the world can also be passed as a raw string with Cli::from_ron_str or Cli::from_json_str.

Dependencies

  • Rust ^1.38.0

Crates

  • rand = "0.7"
  • rayon = "1.0"
  • serde = "1.0"
  • ron = "0.5"
  • serde_json = "1.0"