Skip to content

Instantly share code, notes, and snippets.

@rossimo
Created May 23, 2017 12:16
Show Gist options
  • Save rossimo/1536f456bc25660c22c7edf88013fb21 to your computer and use it in GitHub Desktop.
Save rossimo/1536f456bc25660c22c7edf88013fb21 to your computer and use it in GitHub Desktop.
import * as api from '../api'
api.events.once('ready', async () => {
await api.loadResource('wizard', 'wizard.png');
api.setGraph({
nodes: [
{ name: 'city', x: 2, y: 2 },
{ name: 'gate', x: 4, y: 2 },
{ name: 'tower', x: 7, y: 2 },
{ name: 'outpost', x: 5, y: 0 },
{ name: 'camp', x: 6, y: 4 },
{ name: 'cave', x: 9, y: 4 },
{ name: 'wagon', x: 2, y: 6 },
{ name: 'dungeon', x: 0, y: 9 },
{ name: 'hermit', x: 2, y: 9 },
{ name: 'ship', x: 5, y: 8 },
{ name: 'stone', x: 8, y: 9 },
{ name: 'obelisks', x: 7, y: 11 },
{ name: 'statue', x: 10, y: 8 },
{ name: 'temple', x: 10, y: 10 }
],
edges: [
{ source: 'city', target: 'gate' },
{ source: 'gate', target: 'tower' },
{ source: 'gate', target: 'outpost' },
{ source: 'outpost', target: 'tower' },
{ source: 'gate', target: 'camp' },
{ source: 'camp', target: 'tower' },
{ source: 'camp', target: 'cave' },
{ source: 'tower', target: 'cave' },
{ source: 'gate', target: 'wagon' },
{ source: 'wagon', target: 'hermit' },
{ source: 'wagon', target: 'camp' },
{ source: 'hermit', target: 'dungeon' },
{ source: 'hermit', target: 'ship' },
{ source: 'wagon', target: 'ship' },
{ source: 'ship', target: 'stone' },
{ source: 'stone', target: 'obelisks' },
{ source: 'stone', target: 'statue' },
{ source: 'stone', target: 'temple' },
{ source: 'obelisks', target: 'temple' },
{ source: 'statue', target: 'temple' }
]
});
api.setLocation('gate', true);
await api.waitFor('move', 'tower');
api.showCinematic(
'wizard',
'A wizard appears! What do you do?',
'She\'s weird, leave.');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment