game
The object you pass to the jumbogrove function.
Example:
const game = {
id: 'jg-example',
version: 1,
globalState: {
aliensHaveInvaded: false,
},
willEnter: (model, ui, previousId, nextId) => {
console.log("Transitioning from", previousId, "to", nextId);
},
};
jumbogrove('#app', game);
Member Summary
Public Members | ||
public |
The Markdown string you want to show at the top of the right sidebar. |
|
public |
If you set this to |
|
public |
List of character definitions. |
|
public |
If you set this to |
|
public |
The Markdown string you want to show whenever the game is saved. |
|
public |
globalState: * The initial value of model.globalState. |
|
public |
An ID unique to your game. |
|
public |
The ID of the first situation you want to show the player. |
|
public |
The Markdown string you want to show at the top of the left sidebar. |
|
public |
If you set this to |
|
public |
If you set this to |
|
public |
List of situation definitions. |
|
public |
The current version of your game. |
Method Summary
Public Methods | ||
public |
Called when the game is just executed the given action on the given sitaution. |
|
public |
Called when the game has just entered a new situation. |
|
public |
Called when the game just exited a situation. |
|
public |
Called immediately after all initial objects have been created, but before the first situation has been entered. |
|
public |
Called when the game is about to execute the given action on the given sitaution. |
|
public |
Called when the game has requested to enter a new situation. |
|
public |
Called when the game is about to exit a situation. |
Public Members
public asideHeader: string source
The Markdown string you want to show at the top of the right sidebar. This string is processed by the template engine before being displayed.
public autoScroll: Boolean source
If you set this to false
, the browser will not scroll as new text
is added.
Default true
.
public characters: character source
List of character definitions. Note: this is not the same as the Character class! There's a difference between what you write in your game definition, and what gets passed to the various callbacks.
public defaultStylesheet: Boolean source
If you set this to false
, fewer styles will be applied to
the HTML.
Default true
.
public gameSaveMessage: string source
The Markdown string you want to show whenever the game is saved.
public navHeader: string source
The Markdown string you want to show at the top of the left sidebar.
public showAside: Boolean source
If you set this to false
, the right sidebar will not be shown.
Default true
.
public showNav: Boolean source
If you set this to false
, the left sidebar will not be shown.
Default true
.
Public Methods
public didAct(model: model, ui: ui, situation: Situation, action: string) source
Called when the game is just executed the given action on the given sitaution.
public didEnter(model: model, ui: ui, previousId: string, nextId: string) source
Called when the game has just entered a new situation.
public didExit(model: model, ui: ui, thisId: string, nextId: string) source
Called when the game just exited a situation.
public init(model: model, ui: ui) source
Called immediately after all initial objects have been created, but before the first situation has been entered. This is where you would add Markdown plugins and Nunjucks filters.
public willAct(model: model, ui: ui, situation: Situation, action: string) source
Called when the game is about to execute the given action on the given sitaution.
public willEnter(model: model, ui: ui, previousId: string, nextId: string): Boolean source
Called when the game has requested to enter a new situation. This function returns
a truthy value (true
) if this should be allowed, false
if not.
It is safe to call model.do()
or model.goTo()
from willEnter()
, as long as
you return false
afterward.