Somehwat improved default object position
This commit is contained in:
parent
0ecd951710
commit
cd1daf9345
@ -35,15 +35,19 @@ const imageProps = computed(() => ({
|
|||||||
originY: props.placedMapObject.mapObject.originY
|
originY: props.placedMapObject.mapObject.originY
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
// ... existing code ...
|
||||||
|
|
||||||
function calculateObjectPlacement(mapObj: PlacedMapObject) : {x: number; y: number} {
|
function calculateObjectPlacement(mapObj: PlacedMapObject) : {x: number; y: number} {
|
||||||
let position = tileToWorldXY(props.tileMapLayer, mapObj.positionX, mapObj.positionY)
|
let position = tileToWorldXY(props.tileMapLayer, mapObj.positionX, mapObj.positionY)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
x: position.worldPositionX-mapObj.mapObject.frameWidth/2,
|
x: position.worldPositionX - mapObj.mapObject.frameWidth/2,
|
||||||
y: position.worldPositionY-mapObj.mapObject.frameHeight/2+config.tile_size.height
|
y: position.worldPositionY - mapObj.mapObject.frameHeight + (config.tile_size.height * 1.5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ... existing code ...
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await loadTexture(scene, {
|
await loadTexture(scene, {
|
||||||
key: props.placedMapObject.mapObject.id,
|
key: props.placedMapObject.mapObject.id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user