storygame-sample-nodejs
Version:
Learn to Code JavaScript (Node) with Story Game Programming
21 lines (18 loc) • 429 B
JavaScript
const s = require('storyeng')
s.parts.HouseEntry = {
onenter: 'You stand at the base of a stairway',
oninput: 'HouseBedroom'
}
s.parts.HouseBedroom = {
onenter: 'You see a hole in the roof you can climb into',
oninput: e => {
switch (e.lower) {
case 'roof':
s.go('HouseRoof')
}
}
}
s.parts.HouseRoof = {
onenter: e => `Who do you think you are? ${e.data.name} Claus?`,
oninput: 'Bedroom',
}