object stuff

This commit is contained in:
2024-07-04 13:38:05 +02:00
parent 90121be472
commit aa5b51478a
5 changed files with 16 additions and 11 deletions

View File

@ -70,6 +70,7 @@ import { onBeforeUnmount, ref, watch } from 'vue'
import { useScene } from 'phavuer'
import { getTile } from '@/services/zone'
import { useZoneEditorStore } from '@/stores/zoneEditor'
import TilemapLayer = Phaser.Tilemaps.TilemapLayer
const zoneEditorStore = useZoneEditorStore()
@ -98,7 +99,7 @@ function drawTile(pointer: Phaser.Input.Pointer) {
const px = scene.cameras.main.worldView.x + pointer.x
const py = scene.cameras.main.worldView.y + pointer.y
const pointer_tile = getTile(px, py, props.layer) as Phaser.Tilemaps.Tile
const pointer_tile = getTile(px, py, props.layer as TilemapLayer) as Phaser.Tilemaps.Tile
if (!pointer_tile) {
return
}

View File

@ -57,7 +57,7 @@ type ZoneObject = {
const zoneObjects = ref<ZoneObject[]>([])
/**
* Walk through tiles and add them to the zone as tilesetImages
* Walk through object and add them to the zone as tilesetImages
*/
let tileCount = 1
toRaw(assetStore.assets).forEach((asset) => {
@ -78,10 +78,10 @@ console.log(pos)
// Watch for changes in the zoneStore and update the layer
// watch(
// () => zoneEditorStore.tiles,
// () => zoneEditorStore.object,
// () => {
// // @TODO : change to zone for when loading other maps
// zoneEditorStore.tiles.forEach((row, y) => row.forEach((tile, x) => layer.putTileAt(tile, x, y)))
// zoneEditorStore.object.forEach((row, y) => row.forEach((tile, x) => layer.putTileAt(tile, x, y)))
// },
// { deep: true }
// )