#adventure #engine #game #game-engine #terminal

bin+lib act

Act 是一个用于制作简单、基于文本的冒险游戏的简单引擎。

2 个版本

使用旧的 Rust 2015

0.1.1 2017 年 1 月 4 日
0.1.0 2017 年 1 月 4 日

#15#adventure

无许可证

9KB
180

act

Act 是一个用于制作基于文本的冒险游戏的简单引擎。


lib.rs:

Act 是一个用于制作简单、基于文本的冒险游戏的简单引擎。

它在 crates.ioGitHub 上!

示例

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!
}

依赖关系

~235KB