Depth sorting works semi-better this way
This commit is contained in:
parent
14474f7665
commit
50daf01a01
@ -63,11 +63,11 @@ export function createTileArray(width: number, height: number, tile: string = 'b
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const calculateIsometricDepth = (positionX: number, positionY: number, width: number = 0, height: number = 0, isCharacter: boolean = false) => {
|
export const calculateIsometricDepth = (positionX: number, positionY: number, width: number = 0, height: number = 0, isCharacter: boolean = false) => {
|
||||||
const baseDepth = (positionX + positionY) * 1000
|
const baseDepth = positionX + positionY
|
||||||
if (isCharacter) {
|
if (isCharacter) {
|
||||||
return baseDepth + 500 // Characters should always be above objects at the same position
|
return baseDepth
|
||||||
}
|
}
|
||||||
return baseDepth + (width + height) / 4
|
return baseDepth + (width + height) / (2 * config.tile_size.width)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadTileTextures(tiles: TileT[], scene: Phaser.Scene) {
|
async function loadTileTextures(tiles: TileT[], scene: Phaser.Scene) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user