Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
lajbel committed Sep 12, 2023
1 parent 3f5ab8a commit d5acb08
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 5 deletions.
36 changes: 35 additions & 1 deletion docs/Basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ m.chapter("start", () => [

Now, when you start the game, you will see the text "Hello world!" in the textbox.

See more about actions in the [Actions](/Actions.md) section.

## Characters
Characters are the people that appear in your visual novel. We should define our characters before our chapters. We will use the `character()` function, as parameter, it needs an `id`, a `display name` and we can define some extra options.

Expand All @@ -76,4 +78,36 @@ m.chapter("start", () => [
]);
```

See more about actions in the [Actions](/Actions.md) section.
## Variables
Variables are the values that we can use in our game. We can define variables in the our novel, and we can use them in actions.

```js
m.setVar("girlName", "Juizy");

m.chapter("start", () => [
m.say("j", "Hello world!"),
m.say("j", "My name is [girlName]"),
]);
```

## Choices
Choices are the options that the player can choose. We can define choices in a chapter, and we can define as many choices as we want.

```js
m.chapter("start", () => [
m.say("j", "Hello world!"),
m.say("j", "What's your favorite programming language?"),

m.choice({
"Javascript": {
actions: () => [
m.say("j", "Nice! I like Javascript too!"),
],
},
"Python": {
actions: () => [
m.say("j", "Nice! I like Python too!"),
],
},
}),
]);
25 changes: 22 additions & 3 deletions docs/Type Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ nav-order: 4

### `textOffset?`: undefined

### `textWidth?`: number

## `ChoiceOpt`
### `sprite?`: string

Expand Down Expand Up @@ -65,19 +67,32 @@ nav-order: 4

## `KaboomPlugins`: LayerPlugin

## `TextOptions`
### `textAlign?`: left | center | right

### `textSize?`: number

### `textFont?`: string

### `textColor?`: string

### `textOffset?`: undefined

### `textWidth?`: number

## `GameData`
### `k`: undefined

### `m`: MandarinaPlugin

### `actionStack`: undefined

### `opt`: MandarinaOpt

### `chapters`: Map

### `characters`: Map

### `currentChapter`: string

### `currentAction`: number

### `processingAction`: boolean
Expand All @@ -90,7 +105,7 @@ nav-order: 4

### `isProcessingAction`: boolean

## `Inputs`: pc | gamepad | touch
## `Inputs`: pc | gamepad

## `GameActions`: next | screenshoot

Expand All @@ -114,6 +129,8 @@ nav-order: 4

### `setVar`: undefined

### `setPronoun`: undefined

### `getVar`: T

### `jump`: NormalAction
Expand Down Expand Up @@ -150,6 +167,8 @@ nav-order: 4

### `language?`: english | spanish

### `inputs?`: GameInputs

## `LoadImageOpt`
### `scale?`: number

Expand Down
2 changes: 1 addition & 1 deletion scripts/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fs.writeFileSync("../mandarina.wiki/Type Reference.md", head + markdown);

// Copy wiki in docs
for (const file of fs.readdirSync("../mandarina.wiki/")) {
if (!file.endsWith(".md")) continue;
if (!file.endsWith(".md") && file.startsWith("_")) continue;
if (file === "Home.md") {
fs.copyFileSync("../mandarina.wiki/" + "Home.md", "docs/" + "index.md");
continue;
Expand Down

0 comments on commit d5acb08

Please sign in to comment.