Narration Mechanic

How i made the interactive story mechanic. 

While writing down my ideas for the game in a text document,  (click here to see my original document that i made before even starting to work on the game), i came up with roughly the story you see in the game. copying an pasting the document into my narrator script, which baciclly manages all the events inside the game. removing the parts that the narrator doesnt say, (i had all his speach in quotation marks already)  adding commas between each line and sticking it into an array it ended up looking like this. 

to display the text ive got a game object with a "narration" script, which passes on the infomation, such as dialogue, speed it plays back at and delay before the text dissapears, this narration script gets passed default values each time, in order to get each line i wanted to be different to be different i added on the strings a seperator in this case i used @ which goes in between the various components(dialogue, speed, delay, x position, y positon, whether or not i want to continue or pause/wait for event ) and then used the Text.split() function to take the the current dialogue and split it into individual strings. then i parsed them respectively to turn them into floats and bool. then instantiates a copy of the narration gameobject getting its narration script then passing on the infomation. 

since was using the same function to create the the atack dialgoue, the position isnt changed in the function, but rather returns the game object which then can be transformed in any which way.


since i used an IEnumerator to handle the story narration i could make the script wait until there wasnt any text on screen before starting the next sentance, also waiting for a boolean (that when i want to wait for the player i set to false), to be turned back to true .

ive got a in my update loop an if statment for each position in the array i want to do something on Eg. give player the key, turn on portal

and thats about all for the main narrator mechanic. the whole things only about 300 lines of code, including a line for each of these -->{  }

so not all that big. or complicated. 

i hope there was something you learnt from this, ill do another one of these for the boss battle and player movement, and perhaps clouds... if your interested(probably spend a bit more time on those that i'd like to admit)

Files 16 MB
Aug 31, 2019

Get The game is a liar

Download NowName your own price

Leave a comment

Log in with to leave a comment.