Mittsies music, sync chapter to character

This commit is contained in:
Daniel Bulant 2021-02-28 16:57:37 +01:00
parent f9d592bf32
commit 905d6c67a9
9 changed files with 49 additions and 20 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
/node_modules/ /node_modules/
/public/build/ /public/build/
/build_cache/
.DS_Store .DS_Store
/public/service-worker.js /public/service-worker.js

View file

@ -10,4 +10,6 @@ Dev version available [here](https://heaventaker.danbulant.eu).
## License ## License
The game and art is licensed under AGPL 3. More info about the license [here](https://choosealicense.com/licenses/agpl-3.0/). The game code is licensed under AGPL 3. More info about the license [here](https://choosealicense.com/licenses/agpl-3.0/).
Background music by Mittsies, licensed under CC-NC. Sound effects under CC-0. Sprites CC-BY-NC by hohodo.

Binary file not shown.

Binary file not shown.

View file

@ -4,7 +4,7 @@
import Overlay from "./pages/overlay.svelte"; import Overlay from "./pages/overlay.svelte";
import { characters } from "./stores/characters.js"; import { characters } from "./stores/characters.js";
import { dialog } from "./stores/dialog.js"; import { dialog } from "./stores/dialog.js";
import Game from "./pages/game.svelte"; import Game from "./pages/game.svelte";
var page = "game"; var page = "game";
var current = localStorage.getItem("dialog-page") || 0; var current = localStorage.getItem("dialog-page") || 0;
@ -23,7 +23,7 @@ import Game from "./pages/game.svelte";
} }
var music = new Howl({ var music = new Howl({
src: "/sound/thought_patterns.m4a", src: "/sound/mittsies-departure.mp3",
html5: true, html5: true,
loop: true, loop: true,
autoplay: true autoplay: true
@ -46,8 +46,8 @@ import Game from "./pages/game.svelte";
<title>Heaventaker</title> <title>Heaventaker</title>
</svelte:head> </svelte:head>
<Game /> <Game bind:current />
<Overlay active={gameActive}> <Overlay active={gameActive}>
<Dialog bind:current {characters} bind:page /> <Dialog bind:current page />
</Overlay> </Overlay>

View file

@ -2,10 +2,9 @@
import Button from "./button.svelte"; import Button from "./button.svelte";
import { Howl } from "howler"; import { Howl } from "howler";
import { dialog } from "../stores/dialog.js"; import { dialog } from "../stores/dialog.js";
import { characters } from "../stores/characters.js";
export var current; export var current;
/** @type {any[]} */
export var characters;
export var page; export var page;
/** @type {typeof dialog[number]}*/ /** @type {typeof dialog[number]}*/
@ -90,7 +89,7 @@
* @argument {MouseEvent} e * @argument {MouseEvent} e
*/ */
function next(e) { function next(e) {
var path = e.path || (e.composedPath || (() => {[]}))(); var path = e.composedPath();
if(path.includes(buttons)) return; if(path.includes(buttons)) return;
reset(); reset();
select(); select();

View file

@ -1,7 +1,34 @@
<script> <script>
import GameOverlay from "./gameOverlay.svelte"; import GameOverlay from "./gameOverlay.svelte";
import { dialog } from "../stores/dialog.js";
import { characters } from "../stores/characters.js";
export var current;
var d;
$: d = dialog[current];
var characterIndex;
$: characterIndex = characters.findIndex(c => c.name === d.character);
var character;
$: character = characters[characterIndex];
function toRoman(num) {
if (isNaN(num))
return NaN;
var digits = String(+num).split(""),
key = ["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM",
"","X","XX","XXX","XL","L","LX","LXX","LXXX","XC",
"","I","II","III","IV","V","VI","VII","VIII","IX"],
roman = "",
i = 3;
while (i--)
roman = (key[+digits.pop() + (i * 10)] || "") + roman;
return Array(+digits.join("") + 1).join("M") + roman;
}
var steps = 11;
</script> </script>
<GameOverlay steps={11} chapter={"I"} /> <GameOverlay {steps} chapter={toRoman(characterIndex + 1)} />

View file

@ -1,6 +1,6 @@
import { precacheAndRoute } from 'workbox-precaching'; import { precacheAndRoute } from 'workbox-precaching';
import { registerRoute } from 'workbox-routing'; import { registerRoute } from 'workbox-routing';
import { CacheFirst, StaleWhileRevalidate } from 'workbox-strategies'; import { CacheFirst, NetworkFirst, StaleWhileRevalidate } from 'workbox-strategies';
precacheAndRoute(self.__WB_MANIFEST); precacheAndRoute(self.__WB_MANIFEST);
@ -11,5 +11,5 @@ registerRoute(
registerRoute( registerRoute(
({ request }) => request.destination === "script" || request.destination === "document", ({ request }) => request.destination === "script" || request.destination === "document",
new StaleWhileRevalidate() process.env.NODE_ENV === "production" ? new StaleWhileRevalidate() : new NetworkFirst()
); );

View file

@ -1,12 +1,4 @@
export const characters = [{ export const characters = [{
name: "Michael",
art: "/sprite/michael_normal.webp",
title: "the high marshal",
poses: {
wings: "/sprite/michael_wings.webp",
happy: "/sprite/michael_happy.webp"
}
}, {
name: "Uriel", name: "Uriel",
art: "/sprite/uriel_normal.webp", art: "/sprite/uriel_normal.webp",
title: "the gate guardian", title: "the gate guardian",
@ -15,6 +7,14 @@ export const characters = [{
side_happy: "/sprite/uriel_side_happy.webp", side_happy: "/sprite/uriel_side_happy.webp",
bat: "/sprite/uriel_bat.webp" bat: "/sprite/uriel_bat.webp"
} }
}, {
name: "Michael",
art: "/sprite/michael_normal.webp",
title: "the high marshal",
poses: {
wings: "/sprite/michael_wings.webp",
happy: "/sprite/michael_happy.webp"
}
}, { }, {
name: "Uziel", name: "Uziel",
art: "/sprite/uziel_normal.webp", art: "/sprite/uziel_normal.webp",