Adventure.js Docs Downloads
Score: 0 Moves: 0

Class: Scorecard

Defined in: adventure/Scorecard.js, line 6

Framework class

Scorecard is a repository for Game score options. Scorecard is created automatically by Game. This is an internal class that authors should not need to construct. However, authors can set scoring options from their game file as shown below, and call score updates from custom scripts.

Example:

var MyGame = new adventurejs.Game( "MyGame", "GameDisplay" );
MyGame.scorecard.set({
  score_events: {
    "unlock door": { points: 1, complete: false, bonus: false, message: '', recorded: false },
    "unlock chest": { points: 1, complete: false, bonus: false, recorded: message: '', false },
    "drink potion": { points: 1, complete: false, bonus: false, recorded: message: '', false },
  }
});

Private Constructor:

var foo = new adventurejs.Scorecard(game)

Parameters:

  • game Game
    A reference to the game instance.
Inherited Overrides
IndexMethodsProperties

Methods Collapse all  |  Expand all

aggregateUpdates()

Defined in: adventure/Scorecard.js, line 121

Print score updates in the aggregate.
completeEvent(event) → {Boolean}

Defined in: adventure/Scorecard.js, line 72

Parameters:

  • event String
    A string matching an event key.
Mark the selected event as complete and update the score.

Returns:

Boolean
createEvent() → {String}

Defined in: adventure/Scorecard.js, line 55

Create a new event.

Returns:

String
set(props) → {adventurejs.Scorecard}

Defined in: adventure/Scorecard.js, line 190

Parameters:

  • props Object
    A generic object containing properties to copy to the instance.
Provides a chainable shortcut method for setting a number of properties on the instance.

Returns:

adventurejs.Scorecard Returns the instance the method is called on (useful for chaining calls.)
setScore()

Defined in: adventure/Scorecard.js, line 180

Format the score/total before printing it to display.
stackUpdates()

Defined in: adventure/Scorecard.js, line 145

Print score updates in a stack.
updateScore()

Defined in: adventure/Scorecard.js, line 85

Get the current score.

Properties Collapse all  |  Expand all

Documentation generated by JSDoc 3.6.11 on Mon Nov 20 2023 18:02:32 GMT-0800 (Pacific Standard Time)
Found a problem or error in the docs? Report it to docs@adventurejs.com.