1
0
forked from noxious/client

Minor fix and format

This commit is contained in:
2025-02-14 02:23:13 +01:00
parent f83e2bf8c8
commit 8bf67ab168
10 changed files with 36 additions and 57 deletions

View File

@ -62,18 +62,13 @@ export function createTileArray(width: number, height: number, tile: string = 'b
return Array.from({ length: height }, () => Array.from({ length: width }, () => tile))
}
export const calculateIsometricDepth = (
positionX: number,
positionY: number,
objectWidth: number = 0,
objectHeight: number = 0
): number => {
const tileWidth = config.tile_size.width;
const tileHeight = config.tile_size.height;
const tileSize = Math.max(tileWidth, tileHeight);
const objectSize = Math.max(objectWidth, objectHeight);
return Math.floor(positionY * tileSize + positionX * objectSize);
};
export const calculateIsometricDepth = (positionX: number, positionY: number, width: number = 0, height: number = 0, isCharacter: boolean = false) => {
const baseDepth = positionX + positionY
if (isCharacter) {
return baseDepth
}
return baseDepth + (width + height) / (2 * config.tile_size.width)
}
async function loadTileTextures(tiles: TileT[], scene: Phaser.Scene) {
// Load each tile into the scene