This commit is contained in:
2024-09-19 10:26:46 +02:00
parent 3878a02b4f
commit bb83861433
3 changed files with 25 additions and 20 deletions

View File

@ -60,13 +60,6 @@ const isLoaded = ref(false)
const assetsLoaded = ref(false)
const { assets } = storeToRefs(assetStore)
/**
* Fetch assets from the server when a new zone is loaded
*/
gameStore.connection?.on('zone:character:load_assets', async (zoneId: number) => {
await assetStore.fetchAssetsByZoneId(zoneId)
})
const gameConfig = {
name: 'New Quest',
width: window.innerWidth,
@ -170,7 +163,6 @@ const createScene = (scene: Phaser.Scene) => {
})
scene.load.start()
// scene.load.once('complete', () => {})
})
}
@ -180,8 +172,8 @@ const loadAssets = (scene: Phaser.Scene) => {
if (!asset.frameWidth || !asset.frameHeight) {
console.error('Frame width and height must be defined for spritesheets', asset)
}
scene.load.spritesheet(asset.key, config.server_endpoint + asset.url, { frameWidth: asset.frameWidth, frameHeight: asset.frameHeight })
} else {
scene.load.spritesheet(asset.key, config.server_endpoint + asset.url, { frameWidth: asset.frameWidth ?? 0, frameHeight: asset.frameHeight ?? 0 })
scene.load.image(asset.key, config.server_endpoint + asset.url)
}
})