N/A
This commit is contained in:
parent
2de34d2034
commit
d0af83ec60
@ -61,7 +61,7 @@ function calculateObjectPlacement(mapObj: PlacedMapObject): { x: number; y: numb
|
|||||||
const imageProps = computed(() => ({
|
const imageProps = computed(() => ({
|
||||||
alpha: mapEditor.movingPlacedObject.value?.id == props.placedMapObject.id || mapEditor.selectedMapObject.value?.id == props.placedMapObject.id ? 0.5 : 1,
|
alpha: mapEditor.movingPlacedObject.value?.id == props.placedMapObject.id || mapEditor.selectedMapObject.value?.id == props.placedMapObject.id ? 0.5 : 1,
|
||||||
tint: mapEditor.selectedPlacedObject.value?.id == props.placedMapObject.id ? 0x00ff00 : 0xffffff,
|
tint: mapEditor.selectedPlacedObject.value?.id == props.placedMapObject.id ? 0x00ff00 : 0xffffff,
|
||||||
depth: calculateIsometricDepth(props.placedMapObject.positionX, props.placedMapObject.positionY, mapObject.value!.frameWidth, mapObject.value!.frameHeight, mapObject.value!.originX, mapObject.value!.originY),
|
depth: calculateIsometricDepth(props.placedMapObject.positionX, props.placedMapObject.positionY, mapObject.value!.frameWidth, mapObject.value!.frameHeight),
|
||||||
...calculateObjectPlacement(props.placedMapObject),
|
...calculateObjectPlacement(props.placedMapObject),
|
||||||
flipX: props.placedMapObject.isRotated,
|
flipX: props.placedMapObject.isRotated,
|
||||||
texture: mapObject.value!.id,
|
texture: mapObject.value!.id,
|
||||||
|
@ -62,12 +62,14 @@ export function createTileArray(width: number, height: number, tile: string = 'b
|
|||||||
return Array.from({ length: height }, () => Array.from({ length: width }, () => tile))
|
return Array.from({ length: height }, () => Array.from({ length: width }, () => tile))
|
||||||
}
|
}
|
||||||
|
|
||||||
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) => {
|
||||||
const baseDepth = positionX + positionY
|
const backCornerX = positionX + width
|
||||||
if (isCharacter) {
|
const backCornerY = positionY + height
|
||||||
return baseDepth
|
|
||||||
}
|
const sortingX = (positionX + backCornerX) / 2
|
||||||
return baseDepth + (width + height) / (2 * config.tile_size.width)
|
const sortingY = (positionY + backCornerY) / 2
|
||||||
|
|
||||||
|
return sortingX + sortingY
|
||||||
}
|
}
|
||||||
|
|
||||||
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