refactor: layer 1
This commit is contained in:
parent
cd875f8025
commit
df61a43ab5
|
@ -13,7 +13,13 @@ export default async function createHomestead(Ecs) {
|
|||
data: Array(area.x * area.y).fill(0).map(() => 1 + Math.floor(Math.random() * 4)),
|
||||
source: '/assets/tileset.json',
|
||||
tileSize: {x: 16, y: 16},
|
||||
}
|
||||
},
|
||||
{
|
||||
area,
|
||||
data: Array(area.x * area.y).fill(0),
|
||||
source: '/assets/tileset.json',
|
||||
tileSize: {x: 16, y: 16},
|
||||
},
|
||||
],
|
||||
},
|
||||
Time: {},
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
const layer0 = ecs.get(1).TileLayers.layer(0)
|
||||
const layer1 = ecs.get(1).TileLayers.layer(1)
|
||||
|
||||
const filtered = []
|
||||
|
||||
for (let i = 0; i < projected.length; ++i) {
|
||||
const tile = layer.tile(projected[i])
|
||||
if ([1, 2, 3, 4, 6].includes(tile)) {
|
||||
if (
|
||||
[1, 2, 3, 4, 6].includes(layer0.tile(projected[i]))
|
||||
&& ![7].includes(layer1.tile(projected[i]))
|
||||
) {
|
||||
filtered.push(projected[i])
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,9 +115,7 @@ if (projected?.length > 0) {
|
|||
}
|
||||
|
||||
for (let i = 0; i < projected.length; ++i) {
|
||||
if ([1, 2, 3, 4].includes(layer.tile(projected[i]))) {
|
||||
layer.stamp(projected[i], [[7]])
|
||||
}
|
||||
TileLayers.layer(1).stamp(projected[i], [[7]])
|
||||
}
|
||||
|
||||
Controlled.locked = 0;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
const layer = ecs.get(1).TileLayers.layer(1)
|
||||
|
||||
const filtered = []
|
||||
|
||||
for (let i = 0; i < projected.length; ++i) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
const layer = ecs.get(1).TileLayers.layer(1)
|
||||
|
||||
const filtered = []
|
||||
|
||||
for (let i = 0; i < projected.length; ++i) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user