forked from noxious/client
#343: Depth sorting improvement for character component
This commit is contained in:
parent
d2abf8fda8
commit
dffdd0542f
@ -17,7 +17,7 @@ export function useCharacterSpriteComposable(scene: Phaser.Scene, tilemap: Phase
|
|||||||
const tween = ref<Phaser.Tweens.Tween | null>(null)
|
const tween = ref<Phaser.Tweens.Tween | null>(null)
|
||||||
|
|
||||||
const updateIsometricDepth = (positionX: number, positionY: number) => {
|
const updateIsometricDepth = (positionX: number, positionY: number) => {
|
||||||
isometricDepth.value = calculateIsometricDepth(positionX, positionY, 28, 94, true)
|
isometricDepth.value = calculateIsometricDepth(positionX, positionY, 30, 95, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
const updatePosition = (positionX: number, positionY: number, direction: Direction) => {
|
const updatePosition = (positionX: number, positionY: number, direction: Direction) => {
|
||||||
@ -46,19 +46,16 @@ export function useCharacterSpriteComposable(scene: Phaser.Scene, tilemap: Phase
|
|||||||
duration,
|
duration,
|
||||||
ease: 'Linear',
|
ease: 'Linear',
|
||||||
onStart: () => {
|
onStart: () => {
|
||||||
if (direction === Direction.POSITIVE) {
|
|
||||||
updateIsometricDepth(positionX, positionY)
|
updateIsometricDepth(positionX, positionY)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onUpdate: () => {
|
onUpdate: () => {
|
||||||
|
updateIsometricDepth(positionX, positionY)
|
||||||
currentPositionX.value = characterContainer.value?.x ?? currentPositionX.value
|
currentPositionX.value = characterContainer.value?.x ?? currentPositionX.value
|
||||||
currentPositionY.value = characterContainer.value?.y ?? currentPositionY.value
|
currentPositionY.value = characterContainer.value?.y ?? currentPositionY.value
|
||||||
},
|
},
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
if (direction === Direction.NEGATIVE) {
|
|
||||||
updateIsometricDepth(positionX, positionY)
|
updateIsometricDepth(positionX, positionY)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user