Skip to content

Commit

Permalink
Expands example
Browse files Browse the repository at this point in the history
  • Loading branch information
JujuAdams committed Oct 6, 2024
1 parent c73a10c commit 63c41e2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion chatterbox.yyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions objects/oExampleBasic/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ box = ChatterboxCreate("example.yarn");

//Tell the chatterbox to jump to a node
ChatterboxJump(box, "Start");

ChatterboxNodeChangeCallback(function(_old, _new, _type)
{
show_debug_message("Instruction \"" + string(_type) + "\" moved from node \"" + string(_old) + "\" to \"" + string(_new) + "\"");
});
13 changes: 11 additions & 2 deletions objects/oExampleBasic/Draw_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ draw_set_font(fntDefault);
//Iterate over all text and draw it
var _x = 10;
var _y = 10;
var _height = string_height("M");

if (ChatterboxIsStopped(box))
{
Expand All @@ -19,7 +20,7 @@ else
{
var _string = ChatterboxGetContent(box, _i);
draw_text(_x, _y, _string);
_y += string_height(_string);
_y += _height;
++_i;
}

Expand All @@ -30,6 +31,7 @@ else
{
//If we're in a "waiting" state then prompt the user for basic input
draw_text(_x, _y, "(Press Space)");
_y += _height;
}
else
{
Expand All @@ -39,8 +41,15 @@ else
{
var _string = ChatterboxGetOption(box, _i);
draw_text(_x, _y, string(_i+1) + ") " + _string);
_y += string_height(_string);
_y += _height;
++_i;
}
}

//Bit more spacing...
_y += 30;

draw_text(_x, _y, "Node = " + string(ChatterboxGetCurrent(box)));
_y += _height;
draw_text(_x, _y, "Previous = " + string(ChatterboxGetPrevious(box)));
}
4 changes: 2 additions & 2 deletions rooms/rmExample/rmExample.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 63c41e2

Please sign in to comment.