Procházet zdrojové kódy

Worked on the Fen story. Moves have descriptions. Added exit function equivalents for exits themselves

tags/v0.1.0
Fen Dweller před 6 roky
rodič
revize
6f641eac69
3 změnil soubory, kde provedl 118 přidání a 6 odebrání
  1. +3
    -2
      satiate.js
  2. +100
    -0
      stories/fen-snack.js
  3. +15
    -4
      world.js

+ 3
- 2
satiate.js Zobrazit soubor

@@ -2,12 +2,13 @@

let activeModal = null;

const newline = String.fromCharCode(160);
const version = "pre-alpha";

let state;

function print(lines) {
(lines.concat([String.fromCharCode(160)])).forEach(line => {
(lines.concat([newline])).forEach(line => {
const log = document.querySelector("#log");
const div = document.createElement("div");

@@ -69,7 +70,7 @@ function init(story) {
}
}
};
initWorld(story, state);
initAudio(story, state);
initGame(story, state);


+ 100
- 0
stories/fen-snack.js Zobrazit soubor

@@ -2,6 +2,7 @@ stories.push({
id: "fen-snack",
name: "Fen's Food",
sounds: [
"sfx/digested-test.ogg",
"loop/fen-stomach.ogg",
"loop/fen-intestines.ogg",
"loop/fen-bowels.ogg"
@@ -25,7 +26,106 @@ stories.push({
},
hooks: [

],
actions: [
{
name: "Rub",
desc: "Knead on the muscular folds that surround your tasty little body",
execute: (room, state) => {
print(["You rub all over your prison's walls. Fen's stomach doesn't respond."]);
}
},
{
name: "Submit",
desc: "Let Fen digest you",
execute: (room, state) => {
print(["You slump down in the acidic pit, curling up as it begins to churn you down to chyme. Fen's stomach snarls and bubbles for the next few minutes...and then you're gone~",newline,"Nothing's left but a bit of padding on your predator's hips..."]);

goToRoom("digested", state);
}
}
],
exits: {
"down": {
"target": "intestines",
"desc": "Push yourself deeper into the crux",
move: (room, state) => {
print(["You manage to push yourself down through the valve at the base of the crux's fetid stomach."]);
},
hooks: [
(room, exit, state) => {
if (Math.random() < 0.5) {
print(["Fen's stomach clenches and ripples, smothering your face in wet flesh and keeping you nice and trapped."]);
return false;
} else {
return true;
}
}
]
}
}
},
intestines: {
id: "intestines",
name: "Intestines",
desc: "Labyrinthine guts, winding on and on...",
move: (room, state) => {
print(["Your squirming body glides into the crux's tight, snaking guts."]);
},
enter: (room, state) => {
playLoop("loop/fen-intestines.ogg");
},
exit: (room, state) => {
stopLoop("loop/fen-intestines.ogg");
},
exits: {
"up": {
target: "stomach",
desc: "Writhe back into Fen's roiling stomach"
},
"down": {
target: "bowels",
desc: "Push yourself even deeper into your predator's body"
}
},
hooks: [

]
},
bowels: {
id: "bowels",
name: "Bowels",
desc: "Cavernous bowels, rippling and squeezing over your bare skin",
move: (room, state) => {
print(["You enter the beast's humid bowels, taking shallow, stifled breaths of the musky air."]);
},
enter: (room, state) => {
playLoop("loop/fen-bowels.ogg");
},
exit: (room, state) => {
stopLoop("loop/fen-bowels.ogg");
},
exits: {
"up": {
target: "intestines",
desc: "Squirm up higher"
}
},
hooks: [

]
},
digested: {
id: "digested",
name: "Fen's Hips",
desc: "You look good on him, at least~",
enter: (room, state) => {
playLoop("loop/fen-intestines.ogg");
playSfx("sfx/digested-test.ogg");
},
exit: (room, state) => {
stopLoop("loop/fen-intestines.ogg");
},
}
}
});

+ 15
- 4
world.js Zobrazit soubor

@@ -55,14 +55,17 @@ function moveToRoom(src, exit, dest, state) {
}
}

if (exit.move)
exit.move(from, state);

if (from && from.exit)
from.exit(state.world[dest], state);
from.exit(from, state);

if (room.move)
room.move(state.world[dest], state);
room.move(room, state);

if (room.enter)
room.enter(state.world[dest], state);
room.enter(room, state);

state.player.location = dest;

@@ -83,7 +86,7 @@ function goToRoom(dest, state) {

if (from && from.exit)
from.exit(state.world[dest], state);
if (room.enter)
room.enter(state.world[dest], state);

@@ -149,6 +152,14 @@ function updateRoom(state) {
// todo: log
moveToRoom(room, exit, exit.target, state);
})

button.addEventListener("mouseenter", () => {
showActionDescription(exit.desc);
});

button.addEventListener("mouseleave", () => {
removeActionDescription();
});
});
}



Načítá se…
Zrušit
Uložit