Skip to content

ckastbjerg/aventura

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aventura

A tiny library for creating CLI adventures.

▄▄▄ ██▒ █▓▓█████ ███▄ █ ▄▄▄█████▓ █ ██ ██▀███ ▄▄▄
▒████▄ ▓██░ █▒▓█ ▀ ██ ▀█ █ ▓ ██▒ ▓▒ ██ ▓██▒▓██ ▒ ██▒▒████▄
▒██ ▀█▄▓██ █▒░▒███ ▓██ ▀█ ██▒▒ ▓██░ ▒░▓██ ▒██░▓██ ░▄█ ▒▒██ ▀█▄
░██▄▄▄▄██▒██ █░░▒▓█ ▄ ▓██▒ ▐▌██▒░ ▓██▓ ░ ▓▓█ ░██░▒██▀▀█▄ ░██▄▄▄▄██ ▓█ ▓██▒▒▀█░ ░▒████▒▒██░ ▓██░ ▒██▒ ░ ▒▒█████▓ ░██▓ ▒██▒ ▓█ ▓██▒ ▒▒ ▓▒█░░ ▐░ ░░ ▒░ ░░ ▒░ ▒ ▒ ▒ ░░ ░▒▓▒ ▒ ▒ ░ ▒▓ ░▒▓░ ▒▒ ▓▒█░ ▒ ▒▒ ░░ ░░ ░ ░ ░░ ░░ ░ ▒░ ░ ░░▒░ ░ ░ ░▒ ░ ▒░ ▒ ▒▒ ░ ░ ▒ ░░ ░ ░ ░ ░ ░ ░░░ ░ ░ ░░ ░ ░ ▒
░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░

Installation

Using Yarn

yarn add aventura

Or using NPM

npm install aventura

Usage

Import the library.

const aventura = require('aventura');

Author your adventure...

const questions = [
  {
    message: 'Hello, what is the capital of Denmark?',
    answer: 'Copenhagen',
    responses: ['Nope, try again...', 'You could just Google it...']
  },
  {
    message: 'What is 2 + 2?',
    answer: a => parseInt(a, 10) === 4,
    responses: ['Try again...', 'Jeez...how hard can it be?']
  }
];

Start the adventure!

aventura(questions);

API

  • message: [string] (required) - The prompting message of
  • answer: [func|string] (required) - Input from the player will be matched against this to see if he/she is allowed to move on to the next question
  • responses [array] (optional) - Any number of clues for the current question. If not supplied, Aventura will provide generic responses.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published