diff --git a/src/App.vue b/src/App.vue index 3496ffe..5730b00 100644 --- a/src/App.vue +++ b/src/App.vue @@ -11,13 +11,13 @@ import useInput from './util/useInput' import usePlayer from './util/usePlayer' import useLightMap from './util/useLightMap' -const { updateTime, time, clock } = useTime() +const { updateTime, time, timeOfDay, clock } = useTime() const { player, direction, dx, dy } = usePlayer() const { inputX, inputY, running, paused, help, inventory } = useInput() const level = createLevel(STAGE_WIDTH + 2, STAGE_HEIGHT + 2) const lightMapEl = ref(undefined) -let lightMap: ReturnType +let updateLightMap: ReturnType player.inventory.push( { name: 'Shovel', type: 'tool', icon: 'shovel', quality: 'bronze', amount: 1 }, @@ -144,7 +144,7 @@ const move = (thisTick: number): void => { y.value += dy_ * fallMultiplier } - lightMap.draw(floorX.value, floorY.value, tx.value, ty.value, time.value) + updateLightMap() lastTick = thisTick } @@ -171,14 +171,14 @@ onMounted(() => { canvas.width = (BLOCK_SIZE + 2) * STAGE_WIDTH const ctx = canvas.getContext('2d')! - lightMap = useLightMap(ctx) + updateLightMap = useLightMap(ctx, floorX, floorY, tx, ty, time, lightBarrier) lastTick = performance.now() move(lastTick) })