1
0
forked from noxious/client

http improvements, fixed link

This commit is contained in:
2024-12-27 00:48:36 +01:00
parent 231f19a30f
commit 6dad7bc9dd
5 changed files with 12 additions and 11 deletions

View File

@ -3,7 +3,7 @@ import Tilemap = Phaser.Tilemaps.Tilemap
import TilemapLayer = Phaser.Tilemaps.TilemapLayer
import Tileset = Phaser.Tilemaps.Tileset
import Tile = Phaser.Tilemaps.Tile
import type { AssetDataT, Zone as ZoneT } from '@/application/types'
import type { AssetDataT, HttpResponse, Zone as ZoneT } from '@/application/types'
import { loadTexture } from '@/composables/gameComposable'
export function getTile(layer: TilemapLayer | Tilemap, x: number, y: number): Tile | undefined {
@ -86,10 +86,10 @@ export function FlattenZoneArray(tiles: string[][]) {
export async function loadZoneTilesIntoScene(zone: ZoneT, scene: Phaser.Scene) {
// Fetch the list of tiles from the server
const tileArray: AssetDataT[] = await fetch(config.server_endpoint + '/assets/list_tiles/' + zone.id).then((response) => response.json())
const tileArray: HttpResponse<AssetDataT[]> = await fetch(config.server_endpoint + '/assets/list_tiles/' + zone.id).then((response) => response.json())
// Load each tile into the scene
for (const tile of tileArray) {
for (const tile of tileArray.data ?? []) {
await loadTexture(scene, tile)
}
}