Start implementing lair
parent
8f214e93bf
commit
a048e3615c
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
||||||
<html><head><title>Assassin bug</title><script defer="defer" src="game.js"></script></head><body><h1>Assassin bug</h1><div aria-live="polite" id="output-area"></div><input id="input-area" placeholder="Type command"/></body></html>
|
<html><head><title>Assassin bug</title><script defer="defer" src="game.js"></script></head><body><h1>Assassin bug</h1><div id="play-area" hidden="true"><div aria-live="polite" id="output-area"></div><input id="input-area" placeholder="Type command"/></div><div id="save-game-found" hidden="true"><h1>Found a save game</h1><button id="load-save-game">Load</button> <button id="start-new-game">New</button></div><div id="before-play"><h1>Welcome</h1><button id="begin">Begin the adventure</button></div></body></html>
|
|
@ -1,8 +0,0 @@
|
||||||
# Insect lair
|
|
||||||
|
|
||||||
## start
|
|
||||||
|
|
||||||
A small alcove
|
|
||||||
|
|
||||||
### first
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
You slowly wake up with a major headache. Thoughts begin to filter through your tired mind. Thoughts you don't remember having before. You notice a major headache with an influx of new senses that you didn't have before. You open your eyes. You touch your head. Upon checking yourself out you look around.
|
||||||
|
You're in a spherical room. The surface appears to be strangely smooth as if melted away by acid. There's a soft glow coming from one of the exits, the only exit you can see.
|
||||||
|
You get up and head north. You enter a tube-shaped tunnel. There are threads coming out of the ceiling and weaving along it. They eminate a soft glow, which is the light you remember seeing from the previous room. The structure appears to be insect made. The glow intensifies to the north.
|
||||||
|
You keep heading north and enter into a spherical room. It's rather large, able to contain hundreds of you. Threads criss-cross the walls and ceiling seemingly at random. There are tunnels heading into each cardinal direction, leading to statues of huge ants, each connected to a bunch of threads. There's a way down.
|
||||||
|
You head down. The tunnel gets wider and you start to hear water somewhere in the distance. The further you go, the more rough the sides appear to become. All of the threads from the previous floor converge in a room to the north.
|
||||||
|
You head north. You find yourself in a circular room. Where everything else appeared to be spherical, this has walls with 90 degree angles. A stream of water runs in from the east and leads to a small bason in the middle of the room, and connect to a glowing orb which floats there.
|
|
@ -25,6 +25,13 @@ export default class Game {
|
||||||
this.output.say(string);
|
this.output.say(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async tell(lines, time) {
|
||||||
|
for (let line of lines) {
|
||||||
|
this.print(line);
|
||||||
|
await this.wait(time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
init(data) {
|
init(data) {
|
||||||
this.rooms = data.rooms.map((room) => {
|
this.rooms = data.rooms.map((room) => {
|
||||||
room.context = this;
|
room.context = this;
|
||||||
|
|
|
@ -10,6 +10,7 @@ export default class Output {
|
||||||
}
|
}
|
||||||
|
|
||||||
say(string) {
|
say(string) {
|
||||||
|
if (string === "") return;
|
||||||
this.sound.play(`assets/scroll.wav`);
|
this.sound.play(`assets/scroll.wav`);
|
||||||
const node = document.createElement("p");
|
const node = document.createElement("p");
|
||||||
string.split("\n").forEach((line) => {
|
string.split("\n").forEach((line) => {
|
||||||
|
@ -18,7 +19,7 @@ export default class Output {
|
||||||
// this.tts.speak(line, false);
|
// this.tts.speak(line, false);
|
||||||
});
|
});
|
||||||
this.history.appendChild(node);
|
this.history.appendChild(node);
|
||||||
this.tts.speak(string);
|
// this.tts.speak(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
play(file) {
|
play(file) {
|
||||||
|
|
|
@ -9,6 +9,8 @@ export default class Sound {
|
||||||
this.ambienceVolume = 1;
|
this.ambienceVolume = 1;
|
||||||
this.musicVolume = 1;
|
this.musicVolume = 1;
|
||||||
this.sfxVolume = 1;
|
this.sfxVolume = 1;
|
||||||
|
this.previousAmbience = "";
|
||||||
|
this.previousMusic = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
play(file) {
|
play(file) {
|
||||||
|
@ -18,6 +20,7 @@ export default class Sound {
|
||||||
}
|
}
|
||||||
|
|
||||||
async setAmbience(file) {
|
async setAmbience(file) {
|
||||||
|
if (file === this.previousAmbience) return;
|
||||||
if (this.ambience) {
|
if (this.ambience) {
|
||||||
const previousAmbience = this.ambience;
|
const previousAmbience = this.ambience;
|
||||||
this.ambience = null;
|
this.ambience = null;
|
||||||
|
@ -25,6 +28,7 @@ export default class Sound {
|
||||||
setTimeout(() => previousAmbience.destroy(), 6000);
|
setTimeout(() => previousAmbience.destroy(), 6000);
|
||||||
}
|
}
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
this.previousAmbience = file;
|
||||||
this.ambience = this.res.stream(file, 0);
|
this.ambience = this.res.stream(file, 0);
|
||||||
this.ambience.setVolume(this.ambienceVolume);
|
this.ambience.setVolume(this.ambienceVolume);
|
||||||
this.ambience.play();
|
this.ambience.play();
|
||||||
|
@ -33,12 +37,14 @@ export default class Sound {
|
||||||
}
|
}
|
||||||
|
|
||||||
setMusic(file) {
|
setMusic(file) {
|
||||||
|
if (file === this.previousMusic) return;
|
||||||
if (this.music) {
|
if (this.music) {
|
||||||
const previousMusic = this.music;
|
const previousMusic = this.music;
|
||||||
setTimeout(() => previousMusic.fadeOut(2), 500);
|
setTimeout(() => previousMusic.fadeOut(2), 500);
|
||||||
setTimeout(() => previousMusic.destroy(), 2000);
|
setTimeout(() => previousMusic.destroy(), 2000);
|
||||||
}
|
}
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
this.previousMusic = file;
|
||||||
this.music = this.res.stream(file, 1);
|
this.music = this.res.stream(file, 1);
|
||||||
this.music.setVolume(this.musicVolume);
|
this.music.setVolume(this.musicVolume);
|
||||||
this.music.play();
|
this.music.play();
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
import Stone from './stone';
|
import Stone from './stone';
|
||||||
import Torch from './torch';
|
import Torch from './torch';
|
||||||
import Cup from './cup';
|
import Cup from './cup';
|
||||||
|
import Statue1 from './statue1';
|
||||||
|
import statue2 from './statue2';
|
||||||
|
import statue3 from './statue3';
|
||||||
|
import statue4 from './statue4';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
Stone,
|
Stone,
|
||||||
Torch,
|
Torch,
|
||||||
Cup
|
Cup,
|
||||||
|
Statue1,
|
||||||
|
statue2,
|
||||||
|
statue3,
|
||||||
|
statue4
|
||||||
]
|
]
|
|
@ -0,0 +1,14 @@
|
||||||
|
import ItemBuilder from '../../engine/builders/item';
|
||||||
|
|
||||||
|
export default new ItemBuilder()
|
||||||
|
.withID("statue1")
|
||||||
|
.withName("a huge ant statue")
|
||||||
|
.withDescription(
|
||||||
|
`Before you stands a big ant statue. One of its six legs is extended outwards, attached to a round device.`
|
||||||
|
)
|
||||||
|
.isTakeable(false)
|
||||||
|
.isUsable(true)
|
||||||
|
.withUseCallback(async function (context) {
|
||||||
|
context.print(`You press the button on the round device attached to the statue's arm.`)
|
||||||
|
})
|
||||||
|
.create();
|
|
@ -0,0 +1,14 @@
|
||||||
|
import ItemBuilder from '../../engine/builders/item';
|
||||||
|
|
||||||
|
export default new ItemBuilder()
|
||||||
|
.withID("statue2")
|
||||||
|
.withName("a huge ant statue")
|
||||||
|
.withDescription(
|
||||||
|
`Before you stands a big ant statue. Two of its six legs is extended outwards, attached to a rectangular device.`
|
||||||
|
)
|
||||||
|
.isTakeable(false)
|
||||||
|
.isUsable(true)
|
||||||
|
.withUseCallback(async function (context) {
|
||||||
|
context.print(`You press the button on the rectangular device attached to the statue's arm.`)
|
||||||
|
})
|
||||||
|
.create();
|
|
@ -0,0 +1,14 @@
|
||||||
|
import ItemBuilder from '../../engine/builders/item';
|
||||||
|
|
||||||
|
export default new ItemBuilder()
|
||||||
|
.withID("statue3")
|
||||||
|
.withName("a huge ant statue")
|
||||||
|
.withDescription(
|
||||||
|
`Before you stands a big ant statue. Three of its six legs are extended outwards, attached to a round stone tablet.`
|
||||||
|
)
|
||||||
|
.isTakeable(false)
|
||||||
|
.isUsable(true)
|
||||||
|
.withUseCallback(async function (context) {
|
||||||
|
context.print(`You examine the stone tablet in the statue's hands. There appear to be symbols on it which you can make out.`);
|
||||||
|
})
|
||||||
|
.create();
|
|
@ -0,0 +1,14 @@
|
||||||
|
import ItemBuilder from '../../engine/builders/item';
|
||||||
|
|
||||||
|
export default new ItemBuilder()
|
||||||
|
.withID("statue4")
|
||||||
|
.withName("a huge ant statue")
|
||||||
|
.withDescription(
|
||||||
|
`Before you is a big statue of an ant, in the process of falling over. All of its legs are bent at the joints.`
|
||||||
|
)
|
||||||
|
.isTakeable(false)
|
||||||
|
.isUsable(true)
|
||||||
|
.withUseCallback(async function (context) {
|
||||||
|
context.print(`You can't seem to figure out what to do with this yet.`)
|
||||||
|
})
|
||||||
|
.create();
|
|
@ -1,9 +1,5 @@
|
||||||
import Start from './start';
|
import Lair from './lair';
|
||||||
import Tunnel1 from './tunnel1';
|
|
||||||
import tunnel2 from './tunnel2';
|
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
Start,
|
...Lair
|
||||||
Tunnel1,
|
|
||||||
tunnel2
|
|
||||||
];
|
];
|
|
@ -0,0 +1,20 @@
|
||||||
|
import RoomBuilder from "../../../engine/builders/room";
|
||||||
|
|
||||||
|
export default new RoomBuilder()
|
||||||
|
.withID("central1")
|
||||||
|
.withTitle("A large spherical chamber")
|
||||||
|
.withFirstDescription(
|
||||||
|
`You exit the tunnel into a large, spherical chamber.
|
||||||
|
There are many more threads across the walls and ceiling here, the glow enveloping you fully in its unnatural light.
|
||||||
|
The chamber appears to be large, able to fit hundreds of you inside.
|
||||||
|
To the northeast, northwest, southeast and southwest you notice large statues representing ants. Threads seem to lead right into them.`
|
||||||
|
)
|
||||||
|
.withDescription(
|
||||||
|
`A large, spherical chamber. Glowing threads criss-cross the walls and ceiling. Around you, statues of ants.`
|
||||||
|
)
|
||||||
|
.withExit("northwest", "statue1")
|
||||||
|
.withExit("northeast", "statue2")
|
||||||
|
.withExit("southwest", "statue3")
|
||||||
|
.withExit("southeast", "statue4")
|
||||||
|
.withExit("south", "tunnel1")
|
||||||
|
.create();
|
|
@ -0,0 +1,17 @@
|
||||||
|
import Start from './start';
|
||||||
|
import Tunnel1 from './tunnel1';
|
||||||
|
import central1 from './central1';
|
||||||
|
import statue1 from './statue1';
|
||||||
|
import statue2 from './statue2';
|
||||||
|
import statue3 from './statue3';
|
||||||
|
import statue4 from '../../items/statue4';
|
||||||
|
|
||||||
|
export default [
|
||||||
|
Start,
|
||||||
|
Tunnel1,
|
||||||
|
central1,
|
||||||
|
statue1,
|
||||||
|
statue2,
|
||||||
|
statue3,
|
||||||
|
statue4
|
||||||
|
];
|
|
@ -0,0 +1,35 @@
|
||||||
|
import RoomBuilder from '../../../engine/builders/room';
|
||||||
|
|
||||||
|
export default new RoomBuilder()
|
||||||
|
.withID("start")
|
||||||
|
.withTitle("A small spherical alcove")
|
||||||
|
.withFirstDescription(
|
||||||
|
`You find yourself in a small, spherical alcove. It feels cold and dark, save from a dim glow which seems to be eluminating the area from the north.
|
||||||
|
The surface appears to be unnaturally smooth, as if melted away using acidic means. It's warm to the touch.`
|
||||||
|
)
|
||||||
|
.withDescription(
|
||||||
|
`A spherical alcove. The smooth surface appears to be melted away using acidic means. There's a dim glow shining in from the north.`
|
||||||
|
)
|
||||||
|
.withExit("north", "tunnel1")
|
||||||
|
.withEnterCallback(async function(context) {
|
||||||
|
if (context.state.get("start.awoken")) return;
|
||||||
|
const { output, wait } = context;
|
||||||
|
context.enableCommandInput(false);
|
||||||
|
await context.tell([
|
||||||
|
"You slowly wake up.",
|
||||||
|
"you're not sure if you were ever conscious about waking up, but right now, you're clearly aware that you were previously asleep.",
|
||||||
|
"In fact, a lot of your thoughts seem foreign to you.",
|
||||||
|
"You're not sure how to feel about this.",
|
||||||
|
"God the headache...",
|
||||||
|
"OK, time to think about this.",
|
||||||
|
"Huh, something else you never did before.",
|
||||||
|
"Where are you?",
|
||||||
|
"You reach up and touch your head.",
|
||||||
|
"OK, that seems to be in order. Your antennae are still there, your mouth parts seem in tact...",
|
||||||
|
"Hmm. All this is strange.",
|
||||||
|
"No use sitting around. You get up and slowly examine your surroundings."
|
||||||
|
], 3000);
|
||||||
|
context.enableCommandInput(true);
|
||||||
|
context.state.set("start.awoken", true);
|
||||||
|
})
|
||||||
|
.create();
|
|
@ -0,0 +1,15 @@
|
||||||
|
import RoomBuilder from "../../../engine/builders/room";
|
||||||
|
|
||||||
|
export default new RoomBuilder()
|
||||||
|
.withID("statue1")
|
||||||
|
.withTitle("The northwestern part of the central chamber")
|
||||||
|
.withFirstDescription(
|
||||||
|
`You walk over to the northwestern part of the central chamber.
|
||||||
|
It is almost entirely taken up by a huge ant statue. One of its six legs are extended outwards, attached to which is a small, round device.`
|
||||||
|
)
|
||||||
|
.withDescription(
|
||||||
|
``
|
||||||
|
)
|
||||||
|
.withExit("southeast", "central1")
|
||||||
|
.withItem("statue1")
|
||||||
|
.create();
|
|
@ -0,0 +1,15 @@
|
||||||
|
import RoomBuilder from "../../../engine/builders/room";
|
||||||
|
|
||||||
|
export default new RoomBuilder()
|
||||||
|
.withID("statue2")
|
||||||
|
.withTitle("The northeastern part of the central chamber")
|
||||||
|
.withFirstDescription(
|
||||||
|
`You walk over to the northeastern part of the central chamber.
|
||||||
|
It is almost entirely taken up by a huge ant statue. Two of its six legs are extended outwards, attached to which is a large, rectangular device.`
|
||||||
|
)
|
||||||
|
.withDescription(
|
||||||
|
``
|
||||||
|
)
|
||||||
|
.withExit("southwest", "central1")
|
||||||
|
.withItem("statue2")
|
||||||
|
.create();
|
|
@ -0,0 +1,15 @@
|
||||||
|
import RoomBuilder from "../../../engine/builders/room";
|
||||||
|
|
||||||
|
export default new RoomBuilder()
|
||||||
|
.withID("statue3")
|
||||||
|
.withTitle("The southwestern part of the central chamber")
|
||||||
|
.withFirstDescription(
|
||||||
|
`You walk over to the southwestern part of the central chamber.
|
||||||
|
It is almost entirely taken up by a huge ant statue. Three of its six legs are extended outwards, attached to which is a round stone tablet.`
|
||||||
|
)
|
||||||
|
.withDescription(
|
||||||
|
``
|
||||||
|
)
|
||||||
|
.withExit("northeast", "central1")
|
||||||
|
.withItem("statue3")
|
||||||
|
.create();
|
|
@ -0,0 +1,15 @@
|
||||||
|
import RoomBuilder from "../../../engine/builders/room";
|
||||||
|
|
||||||
|
export default new RoomBuilder()
|
||||||
|
.withID("statue4")
|
||||||
|
.withTitle("The southeastern part of the central chamber")
|
||||||
|
.withFirstDescription(
|
||||||
|
`You walk over to the southeastern part of the central chamber.
|
||||||
|
It is almost entirely taken up by the statue of a huge ant, which appears to be in the process of falling over. All of its six legs are slightly bent at each joint.`
|
||||||
|
)
|
||||||
|
.withDescription(
|
||||||
|
``
|
||||||
|
)
|
||||||
|
.withExit("northwest", "central1")
|
||||||
|
.withItem("statue4")
|
||||||
|
.create();
|
|
@ -0,0 +1,15 @@
|
||||||
|
import RoomBuilder from '../../../engine/builders/room';
|
||||||
|
|
||||||
|
export default new RoomBuilder()
|
||||||
|
.withID("tunnel1")
|
||||||
|
.withTitle("A long dark tunnel")
|
||||||
|
.withFirstDescription(
|
||||||
|
`You slowly make your way out of the little alcove, heading north into a smooth, tube-shaped tunnel.
|
||||||
|
You notice razor thin threads coming out of the ceiling, weaving and slithering along the length of the tunnel towards the north. Thery provide a dim glow, which must have been the light you saw before.`
|
||||||
|
)
|
||||||
|
.withDescription(
|
||||||
|
`A tube-shaped tunnel. Thin threads seem to exit the ceiling here, eminating a soft glow.`
|
||||||
|
)
|
||||||
|
.withExit("south", "start")
|
||||||
|
.withExit("north", "central1")
|
||||||
|
.create();
|
|
@ -1,33 +0,0 @@
|
||||||
import RoomBuilder from '../../engine/builders/room';
|
|
||||||
|
|
||||||
export default new RoomBuilder()
|
|
||||||
.withID("start")
|
|
||||||
.withTitle("The starting room")
|
|
||||||
.withFirstDescription(
|
|
||||||
`You set foot in your very first ever room.
|
|
||||||
You're not quite sure what you were supposed to expect, but it definitely wasn't this.
|
|
||||||
I mean who would expect a boring old room like this one? Ugh.
|
|
||||||
Just... make it stop. Please.`
|
|
||||||
)
|
|
||||||
.withDescription("The first room. Nothing special about it.")
|
|
||||||
.withExit("north", "tunnel_1")
|
|
||||||
.withExit("northwest", "tunnel_2")
|
|
||||||
.withEnterCallback(async function(context) {
|
|
||||||
if (context.state.get("start.awoken")) return;
|
|
||||||
const { output, wait } = context;
|
|
||||||
context.enableCommandInput(false);
|
|
||||||
output.say("You slowly wake up");
|
|
||||||
await wait(5000);
|
|
||||||
output.say("It's strange. You never used to be able to be conscious about the fact that you were waking up.");
|
|
||||||
await wait(5000);
|
|
||||||
output.say("Yet here we are.");
|
|
||||||
context.enableCommandInput(true);
|
|
||||||
context.state.set("start.awoken", true);
|
|
||||||
})
|
|
||||||
.withItem("stone")
|
|
||||||
.withItem("cup")
|
|
||||||
.withItem("torch")
|
|
||||||
.withAmbience("assets/cave1.wav")
|
|
||||||
.withMusic("assets/music1.wav")
|
|
||||||
.withImpulse("assets/Greek7EchoHall.wav")
|
|
||||||
.create();
|
|
|
@ -1,12 +0,0 @@
|
||||||
import RoomBuilder from '../../engine/builders/room';
|
|
||||||
|
|
||||||
export default new RoomBuilder()
|
|
||||||
.withID("tunnel_1")
|
|
||||||
.withTitle("A long dark tunnel")
|
|
||||||
.withFirstDescription("You first step foot in this dark loomy tunnel.")
|
|
||||||
.withDescription("The walls are wet. Everything is wet. Ugh. Why do you even.")
|
|
||||||
.withExit("south", "start")
|
|
||||||
.withAmbience("assets/windy1.wav")
|
|
||||||
.withMusic("assets/music2.wav")
|
|
||||||
.withImpulse("assets/parkingGarage.wav")
|
|
||||||
.create();
|
|
|
@ -1,13 +0,0 @@
|
||||||
import RoomBuilder from "../../engine/builders/room";
|
|
||||||
|
|
||||||
export default new RoomBuilder()
|
|
||||||
.withID("tunnel_2")
|
|
||||||
.withTitle("A long, winding tunnel")
|
|
||||||
// .withFirstDescription(
|
|
||||||
// `You step out from your hidy hole into a thin, winding tunnel. The walls and ceiling appear to get thinner and thinner, space slowly dwindling away to nothing.`
|
|
||||||
// )
|
|
||||||
.withDescription(
|
|
||||||
`A tunnel that ends in a bowl shape.`
|
|
||||||
)
|
|
||||||
.withExit("southeast", "start")
|
|
||||||
.create();
|
|
Loading…
Reference in New Issue