chore: tidy
This commit is contained in:
parent
f68f8d359e
commit
6957365723
|
@ -39,7 +39,6 @@ export default class Script {
|
||||||
|
|
||||||
static contextDefaults() {
|
static contextDefaults() {
|
||||||
return {
|
return {
|
||||||
Array,
|
|
||||||
console,
|
console,
|
||||||
delta,
|
delta,
|
||||||
lfo,
|
lfo,
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
const layer = ecs.get(1).TileLayers.layer(1)
|
const layer = ecs.get(1).TileLayers.layer(1)
|
||||||
|
const {tileSize} = layer;
|
||||||
|
|
||||||
const filtered = []
|
const filtered = []
|
||||||
|
|
||||||
for (const position of projected) {
|
for (const position of projected) {
|
||||||
const x0 = position.x * layer.tileSize.x;
|
const x0 = position.x * tileSize.x;
|
||||||
const y0 = position.y * layer.tileSize.y;
|
const y0 = position.y * tileSize.y;
|
||||||
const entities = Array.from(ecs.system('Colliders').within({
|
const entities = ecs.system('Colliders').within({
|
||||||
x0,
|
x0,
|
||||||
x1: x0 + layer.tileSize.x - 1,
|
x1: x0 + tileSize.x - 1,
|
||||||
y0,
|
y0,
|
||||||
y1: y0 + layer.tileSize.y - 1,
|
y1: y0 + tileSize.y - 1,
|
||||||
}));
|
});
|
||||||
let hasPlant = false;
|
let hasPlant = false;
|
||||||
for (const {Plant} of entities) {
|
for (const {Plant} of entities) {
|
||||||
if (Plant) {
|
if (Plant) {
|
||||||
|
@ -25,4 +26,4 @@ for (const position of projected) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return filtered
|
filtered
|
||||||
|
|
|
@ -27,7 +27,7 @@ if (projected?.length > 0) {
|
||||||
Plant: {
|
Plant: {
|
||||||
growScript: '/assets/tomato-plant/grow.js',
|
growScript: '/assets/tomato-plant/grow.js',
|
||||||
mayGrowScript: '/assets/tomato-plant/may-grow.js',
|
mayGrowScript: '/assets/tomato-plant/may-grow.js',
|
||||||
stages: Array(5).fill(0.5),
|
stages: [0.5, 0.5, 0.5, 0.5, 0.5],
|
||||||
},
|
},
|
||||||
Sprite: {
|
Sprite: {
|
||||||
anchorY: 0.75,
|
anchorY: 0.75,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user