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/
/public/build/
/build_cache/
.DS_Store
/public/service-worker.js

View file

@ -10,4 +10,6 @@ Dev version available [here](https://heaventaker.danbulant.eu).
## 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 { characters } from "./stores/characters.js";
import { dialog } from "./stores/dialog.js";
import Game from "./pages/game.svelte";
import Game from "./pages/game.svelte";
var page = "game";
var current = localStorage.getItem("dialog-page") || 0;
@ -23,7 +23,7 @@ import Game from "./pages/game.svelte";
}
var music = new Howl({
src: "/sound/thought_patterns.m4a",
src: "/sound/mittsies-departure.mp3",
html5: true,
loop: true,
autoplay: true
@ -46,8 +46,8 @@ import Game from "./pages/game.svelte";
<title>Heaventaker</title>
</svelte:head>
<Game />
<Game bind:current />
<Overlay active={gameActive}>
<Dialog bind:current {characters} bind:page />
<Dialog bind:current page />
</Overlay>

View file

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

View file

@ -1,7 +1,34 @@
<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>
<GameOverlay steps={11} chapter={"I"} />
<GameOverlay {steps} chapter={toRoman(characterIndex + 1)} />

View file

@ -1,6 +1,6 @@
import { precacheAndRoute } from 'workbox-precaching';
import { registerRoute } from 'workbox-routing';
import { CacheFirst, StaleWhileRevalidate } from 'workbox-strategies';
import { CacheFirst, NetworkFirst, StaleWhileRevalidate } from 'workbox-strategies';
precacheAndRoute(self.__WB_MANIFEST);
@ -11,5 +11,5 @@ registerRoute(
registerRoute(
({ 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 = [{
name: "Michael",
art: "/sprite/michael_normal.webp",
title: "the high marshal",
poses: {
wings: "/sprite/michael_wings.webp",
happy: "/sprite/michael_happy.webp"
}
}, {
name: "Uriel",
art: "/sprite/uriel_normal.webp",
title: "the gate guardian",
@ -15,6 +7,14 @@ export const characters = [{
side_happy: "/sprite/uriel_side_happy.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",
art: "/sprite/uziel_normal.webp",