-
-
Save cefn/1d35942b17658d8e696cd34a9e5a7aac to your computer and use it in GitHub Desktop.
Hello World IF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { Story } from "../lib/engine/types"; | |
import { prompt, tell } from "../lib/engine/actions"; | |
import { unhandled } from "../lib/util"; | |
export const story: Story = function* () { | |
yield* tell( | |
<> | |
You wake bruised in a darkened, musty room with the freshness of the sound | |
of running water | |
</> | |
); | |
const choice = yield* prompt( | |
<> | |
You've no idea how you arrived here, but you are so groggy and exhausted | |
you're not sure if you can even stand up. | |
</>, | |
{ | |
run: <>Run Away</>, | |
sleep: <>Go back to sleep</>, | |
} | |
); | |
if (choice === "sleep") { | |
yield* tell( | |
<> | |
You go back to sleep and die peacefully from Carbon Monoxide poisoning, | |
thanks to a poorly maintained gas fire. | |
</> | |
); | |
return; | |
} | |
else if (choice === "run") { | |
yield* tell( | |
<> | |
You run away and die horribly when you are involved in an accident with | |
agricultural machinery | |
</> | |
); | |
return; | |
} | |
unhandled(choice); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment