Tag: game_development

Creating Interactive Dialogue in Javascript with JSON: Part 1

Jun 2, 2018 8 min.

In this series I’m going to go over creating a Javascript program that iterates over JSON to tell an interactive story. Here’s an example: var Story; if (Story !== undefined) { console.log("Story is already defined"); } else { import('/js/story.js') .then(result = { Story = result.Story; MakeUIHandler(); function MakeUIHandler() { const characterName = document.querySelector('#characterName1'); const buttons = document.querySelector('#buttons1'); const displayText = document.querySelector('#text1'); console.log('\/json\/introToDialogue.json') fetch('\/json\/introToDialogue.json') .then(function(response){ return response.