Main example working

This commit is contained in:
2019-05-01 01:06:01 -06:00
parent 7f76bce4ea
commit 9889f6cf14
9 changed files with 62 additions and 26 deletions

24
examples/main/extra.hank Normal file
View File

@@ -0,0 +1,24 @@
// comments in Hank start with a double-slash
/* Or you can split comments
across more than one line */
/* Or you can use block comments inline */
~ var demo_var = "dynamic content"; // Hank scripts can embed Haxe logic by starting a line with '~'
~ var part1 = "haxe";
~ var part2 = "expressions";
~ var flag = false;
~ var word = "identical";
== choice_example
You can include choices for the player.
* Door A [looks promising!] opens and there's nothing behind it.
~ flag = true;
~ var what_happened = "mouse";
+ Door B []opens but the room on the other side is {word}!
* {flag} Choices can depend on logical conditions being truthy.
-> final_choice
- -> choice_example // a hyphen gathers all choices to the same place.
// TODO what about default choices?

41
examples/main/main.hank Normal file
View File

@@ -0,0 +1,41 @@
INCLUDE extra.hank
-> start // This syntax moves the game flow to a new section.
== start
This is a section of a Hank story. It's pretty much like a Knot in Ink.
Line breaks define the chunks of this section that will eventually get sent to your game to process/*sans the content of any comments*/!
Your Hank scripts will contain the static content of your game, but they can also insert {demo_var}, even the result of complex {part1 + " " + part2}!
~ var multiline_logic = "Logic can happen on any line before a multiline comment.";
// TODO is the next line even true anymore?
/* Multiline block have to start at the
beginning of their own line. And can't contain
any other logic on the same line as the start or end. Sorry! */
~ multiline_logic = "Logic can happen on any line after a multiline comment.";
-> choice_example
== final_choice
// should be empty line
```
var variable_declared_in_block="mouse";
// This is a comment INSIDE a haxe block
/*The whole block will be parsed and executed at the same time*/
```
* I don't think I'll use Hank for my games.
Are you sure?
** Yes I'm sure.
That's perfectly valid!
-> the_end
** I've changed my mind.
-> final_choice
* Hank sounds awesome, thanks!
-> the_end
== the_end
That's the end of this example!
These should all say 'mouse':
{what_happened}
{variable_declared_in_block}

27
examples/main/test1.hlog Normal file
View File

@@ -0,0 +1,27 @@
This is a section of a Hank story. It's pretty much like a Knot in Ink.
Line breaks define the chunks of this section that will eventually get sent to your game to process!
Your Hank scripts will contain the static content of your game, but they can also insert dynamic content, even the result of complex haxe expressions!
You can include choices for the player.
* Door A looks promising!
* Door B
> 1: Door A opens and there's nothing behind it.
You can include choices for the player.
* Door B
* Choices can depend on logical conditions being truthy.
> 1: Door B opens but the room on the other side is identical!
You can include choices for the player.
* Door B
* Choices can depend on logical conditions being truthy.
> 2: Choices can depend on logical conditions being truthy.
* I don't think I'll use Hank for my games.
* Hank sounds awesome, thanks!
> 1: I don't think I'll use Hank for my games.
Are you sure?
* Yes I'm sure.
* I've changed my mind.
> 1: Yes I'm sure.
That's perfectly valid!
That's the end of this example!
These should all say 'mouse':
mouse
mouse

22
examples/main/test2.hlog Normal file
View File

@@ -0,0 +1,22 @@
This is a section of a Hank story. It's pretty much like a Knot in Ink.
Line breaks define the chunks of this section that will eventually get sent to your game to process!
Your Hank scripts will contain the static content of your game, but they can also insert dynamic content, even the result of complex haxe expressions!
You can include choices for the player.
* Door A looks promising!
* Door B
> 1: Door A opens and there's nothing behind it.
You can include choices for the player.
* Door B
* Choices can depend on logical conditions being truthy.
> 1: Door B opens but the room on the other side is identical!
You can include choices for the player.
* Door B
* Choices can depend on logical conditions being truthy.
> 2: Choices can depend on logical conditions being truthy.
* I don't think I'll use Hank for my games.
* Hank sounds awesome, thanks!
> 2: Hank sounds awesome, thanks!
That's the end of this example!
These should all say 'mouse':
mouse
mouse