forked from noxious/client
http improvements, fixed link
This commit is contained in:
@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user