silphius/resources/tomato-plant/grow.js
2024-10-18 00:37:31 -05:00

20 lines
368 B
JavaScript

export default function*({ecs, plant}) {
const {Interactive, Sprite} = ecs.get(plant.entity);
Sprite.zIndex = 65535;
plant.growth = 0
if (plant.stage < 3) {
plant.stage += 1
}
if (4 === plant.stage) {
plant.stage = 3
}
if (3 === plant.stage) {
Interactive.interacting = true;
}
Sprite.animation = ['stage', plant.stage].join('/')
}