Several map editor improvements

This commit is contained in:
2024-11-05 21:28:12 +01:00
parent d81c889426
commit e1b39c42ec
6 changed files with 19 additions and 5 deletions

View File

@ -191,7 +191,19 @@ onMounted(() => {
if (!zoneEditorStore.zone?.tiles) {
return
}
setLayerTiles(tileMap, tileLayer, zoneEditorStore.zone.tiles)
// First fill the entire map with blank tiles
const blankTiles = createTileArray(tileMap.width, tileMap.height, 'blank_tile')
// Then overlay the zone tiles on top
const zoneTiles = zoneEditorStore.zone.tiles
for (let y = 0; y < zoneTiles.length; y++) {
for (let x = 0; x < zoneTiles[y].length; x++) {
blankTiles[y][x] = zoneTiles[y][x]
}
}
setLayerTiles(tileMap, tileLayer, blankTiles)
scene.input.on(Phaser.Input.Events.POINTER_MOVE, pencil)
scene.input.on(Phaser.Input.Events.POINTER_MOVE, eraser)