forked from noxious/client
Map editor tiles improvement
This commit is contained in:
parent
e1b39c42ec
commit
e711e124ce
@ -192,16 +192,19 @@ onMounted(() => {
|
||||
return
|
||||
}
|
||||
|
||||
// First fill the entire map with blank tiles
|
||||
const blankTiles = createTileArray(tileMap.width, tileMap.height, 'blank_tile')
|
||||
// First fill the entire map with blank tiles using current zone dimensions
|
||||
const blankTiles = createTileArray(zoneEditorStore.zone.width, zoneEditorStore.zone.height, 'blank_tile')
|
||||
|
||||
// Then overlay the zone tiles on top
|
||||
// Then overlay the zone tiles, but only within the current zone dimensions
|
||||
const zoneTiles = zoneEditorStore.zone.tiles
|
||||
for (let y = 0; y < zoneTiles.length; y++) {
|
||||
for (let x = 0; x < zoneTiles[y].length; x++) {
|
||||
for (let y = 0; y < zoneEditorStore.zone.height; y++) {
|
||||
for (let x = 0; x < zoneEditorStore.zone.width; x++) {
|
||||
// Only copy if the source tiles array has this position
|
||||
if (zoneTiles[y] && zoneTiles[y][x] !== undefined) {
|
||||
blankTiles[y][x] = zoneTiles[y][x]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setLayerTiles(tileMap, tileLayer, blankTiles)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user