0.2.0 • Published 9 years ago

properjs-gamequest v0.2.0

Weekly downloads
2
License
-
Repository
github
Last release
9 years ago

GameQuest

Keep a log of a games quests and their statuses.

Installation

npm install properjs-gamequest --save-dev

Usage

GameQuest will utilize localStorage. So, quest state is persisted and it will try to load from storage on initialization.

var GameQuest = require( "properjs-gamequest" );
var gameQuest = new GameQuest();

// Add a new quest
if ( !gameQuest.isQuestComplete( "my-quest" ) ) {
    // You now have an un-fulfilled quest in the log
    gameQuest.addQuest( "my-quest" );
}

// Fulfill a quest
if ( /* some player action */ ) {
    gameQuest.completeQuest( "my-quest" );
}

// Also
gameQuest.getQuest( id );
gameQuest.removeQuest( id );
gameQuest.getQuest( id );

// See all
gameQuest.getQuests();

// Save to localStorage manually
// GameQuest automatically does this for you though
gameQuest.setQuests();