2 releases
Uses old Rust 2015
0.1.1 | Jan 4, 2017 |
---|---|
0.1.0 | Jan 4, 2017 |
#16 in #adventure
9KB
180 lines
act
Act is a simple engine for making text-based adventure games.
lib.rs
:
Act is a simple engine for making simple, text-based adventure games.
It's on crates.io and on GitHub!
Examples
extern crate act;
use act::load_game;
fn main() {
// Create a string containing our Act game
let game_string = r#"
{
"rooms": [
{
"name": "start",
"scene": "Im a starting room! Welcome to this example game.",
"actions": [
{
"variant": "Move",
"fields": [
"Move to another room","example",""
]
}
]
},
{
"name": "example",
"scene": "You enter an example room, with a big, triangular key in it. Theres also a door with a keyhole in triangular shape.",
"actions": [
{
"variant": "PickUp",
"fields": [
"Pick the key up","TriangleKey",""
]
},
{
"variant": "Move",
"fields": [
"Try to open the door","locked","TriangleKey"
]
}
]
},
{
"name": "locked",
"scene": "You picked an item up and used it to open the door! This is the final room. Congratz!",
"actions": [
{
"variant": "Move",
"fields": [
"Move to another room","example",""
]
}
]
}
]
}
"#;
// Load the game into a proper Game struct
let mut game = load_game(game_string).unwrap();
// Start the game
game.play();
// Profit!
}
Dependencies
~235KB