diff --git a/index.html b/index.html index 626aabf..d55d713 100644 --- a/index.html +++ b/index.html @@ -49,7 +49,7 @@ right: 0; color: white; } - #help { + .screen { position: absolute; top: 0; left: 0; @@ -57,14 +57,8 @@ padding: 1em; background: transparent; color: white; - column-count: 2; - column-gap: 40px; - column-rule: 1px dotted gray; backdrop-filter: blur(5px) sepia(.8) brightness(0.4); } - header { - column-span: all; - } h2 { font-size: 1rem; font-weight: bold; diff --git a/src/App.vue b/src/App.vue index 0961637..4381053 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,8 @@ + + + + diff --git a/src/util/useInput.ts b/src/util/useInput.ts index 61ca1d3..85a54c6 100644 --- a/src/util/useInput.ts +++ b/src/util/useInput.ts @@ -7,6 +7,7 @@ export default function useInput() { let digging = ref(false) let paused = ref(false) let help = ref(false) + let inventory = ref(false) let wasPaused = false @@ -39,6 +40,11 @@ export default function useInput() { help.value = !help.value paused.value = help.value || wasPaused break + case 'i': + if (paused.value && !inventory.value) wasPaused = true + inventory.value = !inventory.value + paused.value = inventory.value || wasPaused + break } } @@ -77,5 +83,6 @@ export default function useInput() { digging, paused, help, + inventory, } } diff --git a/src/util/usePlayer.ts b/src/util/usePlayer.ts index fd7a0cc..f5327ae 100644 --- a/src/util/usePlayer.ts +++ b/src/util/usePlayer.ts @@ -1,20 +1,13 @@ import { computed, reactive } from 'vue' import { RECIPROCAL, STAGE_WIDTH, STAGE_HEIGHT } from '../level/def' -export interface Moveable { - x: number, // position on x-axis (fixed for the player) - y: number, // position on y-axis (fixed for the player) - lastDir: number, // store last face direction - vx: number, // velocity on the x-axis - vy: number, // velocity on the y-axis -} - -const player = reactive({ +const player: Player = reactive({ x: (STAGE_WIDTH + 2) / 2, y: (STAGE_HEIGHT + 2) / 2, lastDir: 0, vx: 0, vy: 1, // always falling, because of gravity + inventory: {}, // not yet in use }) export default function usePlayer() { diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 11f02fe..832495d 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -1 +1,25 @@ /// + +declare global { + interface Moveable { + x: number // position on x-axis (fixed for the player) + y: number // position on y-axis (fixed for the player) + lastDir: number // store last face direction + vx: number // velocity on the x-axis + vy: number // velocity on the y-axis + } + + type Inventory = { + } + + interface Player extends Moveable { + inventory: Inventory + } + + interface Npc extends Moveable { + hostile: boolean + inventory: Inventory + } +} + +export {}