-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56acf2d
commit 969d180
Showing
5 changed files
with
131 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
- I looked at Monsieur Fogg | ||
* ... and I could contain myself no longer. | ||
'What is the purpose of our journey, Monsieur?' | ||
'A wager,' he replied. | ||
* * 'A wager!'[] I returned. | ||
He nodded. | ||
* * * 'But surely that is foolishness!' | ||
* * * 'A most serious matter then!' | ||
- - - He nodded again. | ||
* * * 'But can we win?' | ||
'That is what we will endeavour to find out,' he answered. | ||
* * * 'A modest wager, I trust?' | ||
'Twenty thousand pounds,' he replied, quite flatly. | ||
* * * I asked nothing further of him then[.], and after a final, polite cough, he offered nothing more to me. <> | ||
* * 'Ah[.'],' I replied, uncertain what I thought. | ||
- - After that, <> | ||
* ... but I said nothing[] and <> | ||
- we passed the day in silence. | ||
- -> END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: "main" | ||
scale_along_z: 0 | ||
embedded_instances { | ||
id: "example" | ||
data: "components {\n" | ||
" id: \"example\"\n" | ||
" component: \"/example-defold/example.script\"\n" | ||
" position {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" }\n" | ||
" rotation {\n" | ||
" x: 0.0\n" | ||
" y: 0.0\n" | ||
" z: 0.0\n" | ||
" w: 1.0\n" | ||
" }\n" | ||
"}\n" | ||
"" | ||
position { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
} | ||
rotation { | ||
x: 0.0 | ||
y: 0.0 | ||
z: 0.0 | ||
w: 1.0 | ||
} | ||
scale3 { | ||
x: 1.0 | ||
y: 1.0 | ||
z: 1.0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
local narrator = require('narrator.narrator') | ||
|
||
function init(self) | ||
-- Parse and save a book. | ||
local book = narrator.parseFile('example-defold.book', { save = true }) | ||
|
||
-- Or parse a book from the string with Ink content | ||
-- local book = narrator.parseBook('Hello world!') | ||
|
||
-- Or load a book from the saved lua module | ||
-- local book = require('example-defold.book') | ||
|
||
-- Init a story | ||
local story = narrator.initStory(book) | ||
|
||
-- Begin the story | ||
story:begin() | ||
|
||
print('--- Game started ---') | ||
|
||
while story:canContinue() do | ||
-- Get current paragraphs to output | ||
local paragraphs = story:continue() | ||
|
||
-- Output text to the player | ||
for _, paragraph in ipairs(paragraphs) do | ||
print(paragraph.text) | ||
end | ||
|
||
-- If there is no choice, it seems the game is over | ||
if not story:canChoose() then | ||
break | ||
end | ||
print('') | ||
|
||
-- Get available choices and output them to the player | ||
local choices = story:getChoices() | ||
for i, choice in ipairs(choices) do | ||
print(i .. ') ' .. choice) | ||
end | ||
|
||
-- Send an answer to the story to generate new paragraphs | ||
local answer = 1 | ||
story:choose(answer) | ||
|
||
print('') | ||
end | ||
|
||
print('--- Game over ---') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[bootstrap] | ||
main_collection = /example-defold/examlpe.collectionc | ||
render = /builtins/render/default.renderc | ||
|
||
[script] | ||
shared_state = 1 | ||
|
||
[display] | ||
width = 960 | ||
height = 640 | ||
|
||
[android] | ||
input_method = HiddenInputField | ||
|
||
[project] | ||
title = Narrator | ||
dependencies = https://github.com/astrochili/defold-lpeg/archive/1.0.zip | ||
|
||
[library] | ||
include_dirs = narrator | ||
|
||
[input] | ||
game_binding = /builtins/input/all.input_bindingc | ||
|