From 888aa07139d227ae7013f884d27aa541cc314cc4 Mon Sep 17 00:00:00 2001 From: yisus82 Date: Tue, 30 Apr 2024 11:29:56 +0200 Subject: [PATCH] Fix paths --- src/main.ts | 6 +++--- src/utils.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index ea457d5..6c8c3a3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,7 +13,7 @@ import { makeMap } from './utils'; const gameSetup = async () => { // load animations - k.loadSprite('sprites', '/spritesheet.png', { + k.loadSprite('sprites', './spritesheet.png', { sliceX: 9, sliceY: 10, anims: { @@ -30,7 +30,7 @@ const gameSetup = async () => { }); // load level 1 - k.loadSprite('level-1', '/level-1.png'); + k.loadSprite('level-1', './level-1.png'); const { map: level1Map, spawnPoints: level1SpawnPoints, @@ -85,7 +85,7 @@ const gameSetup = async () => { }); // load level 2 - k.loadSprite('level-2', '/level-2.png'); + k.loadSprite('level-2', './level-2.png'); const { map: level2Layout, spawnPoints: level2SpawnPoints, diff --git a/src/utils.ts b/src/utils.ts index 0b93f06..686c849 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -4,7 +4,7 @@ import { TiledMap } from './types'; export const makeMap = async (k: KaboomCtx, name: string) => { let error = null; - const mapData: TiledMap = await fetch(`/${name}.json`) + const mapData: TiledMap = await fetch(`./${name}.json`) .then(res => res.json()) .catch(e => (error = e)); const map = k.make([k.sprite(name), k.scale(SCALE), k.pos(0)]);