|
|
|
@ -16,9 +16,9 @@ const { inputX, inputY, running, digging, paused, help, inventory } = useInput()
|
|
|
|
|
const level = createLevel(STAGE_WIDTH + 2, STAGE_HEIGHT + 2)
|
|
|
|
|
|
|
|
|
|
player.inventory.push(
|
|
|
|
|
{ name: 'Shovel', type: 'tool', icon: 'shovel', quality: 'bronze' },
|
|
|
|
|
{ name: 'Sword', type: 'weapon', icon: 'sword', quality: 'bronze' },
|
|
|
|
|
{ name: 'Pick Axe', type: 'tool', icon: 'pick', quality: 'bronze' },
|
|
|
|
|
{ name: 'Shovel', type: 'tool', icon: 'shovel', quality: 'bronze', amount: 1 },
|
|
|
|
|
{ name: 'Sword', type: 'weapon', icon: 'sword', quality: 'bronze', amount: 2 },
|
|
|
|
|
{ name: 'Pick Axe', type: 'tool', icon: 'pick', quality: 'bronze', amount: 1 },
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
let animationFrame = 0
|
|
|
|
@ -32,8 +32,9 @@ const tx = computed(() => (x.value - floorX.value) * -BLOCK_SIZE)
|
|
|
|
|
const ty = computed(() => (y.value - floorY.value) * -BLOCK_SIZE)
|
|
|
|
|
const rows = computed(() => level.grid(floorX.value, floorY.value))
|
|
|
|
|
|
|
|
|
|
const arriving = ref(true)
|
|
|
|
|
const walking = ref(false)
|
|
|
|
|
const inventorySelection = ref<InventoryItem | null>(null)
|
|
|
|
|
const inventorySelection = ref<InventoryItem>(player.inventory[0])
|
|
|
|
|
|
|
|
|
|
type Surroundings = {
|
|
|
|
|
at: Block,
|
|
|
|
@ -113,6 +114,10 @@ const move = (thisTick: number): void => {
|
|
|
|
|
const optimal = 16 // 16ms per tick => 60 FPS
|
|
|
|
|
const movementMultiplier = (tickDelta / optimal) * 2
|
|
|
|
|
|
|
|
|
|
if (arriving.value && dy_ === 0) {
|
|
|
|
|
arriving.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
walking.value = !!dx_
|
|
|
|
|
|
|
|
|
|
x.value += dx_ * movementMultiplier
|
|
|
|
@ -148,6 +153,9 @@ onMounted(() => {
|
|
|
|
|
></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id="beam" v-if="arriving"></div>
|
|
|
|
|
|
|
|
|
|
<div id="level-indicator">
|
|
|
|
|
x:{{ floorX }}, y:{{ floorY }}
|
|
|
|
|
<template v-if="paused">(PAUSED)</template>
|
|
|
|
|