UNPKG

storygame-sample-nodejs

Version:

Learn to Code JavaScript (Node) with Story Game Programming

26 lines (22 loc) 592 B
const s = require('storyeng') s.parts.Start = { onenter: `Welcome to this story game.`, oninput: 'Name' } s.parts.Name = { onenter: `My name is Norman, your narrator. What's yours?`, oninput: e => { s.data.name = e.line s.go('HouseEntry') }, onleave: e => `Well nice to meet you, ${e.data.name}.` } s.parts.Bird = { onenter: e => ` Say, ${e.data.name}, do you see that odd bird there flying while apparently carrying something? I wonder what kind of bird that is? Do you know?`, oninput: e => { s.data.birdchoice = e.line s.go('HouseEntry') } }