function.js
export const init = (term) => {
term.clear();
term.hideCursor();
term.grabInput();
term("Welcome to the mining game!");
};
export const updateGold = (term, state) => {
term.moveTo(25, 2);
term.eraseLineAfter();
term.bold.yellow(`${state.gold} `);
state.gold += state.productionRate;
};
export const checkInitCompleted = (term, state) => {
state.isInitCompleted = true;
term.moveTo(0, 1);
term.clear();
term(
"You can purchase producers by clicking the number button (1, 2, 3, ...)"
);
term.moveTo(0, 2);
term("GOLD:");
term.moveTo(0, 3);
term("PRODUCTION RATE:");
state.isProducerListUpdated = false;
};
export const updateProducerList = (term, state) => {
term.moveTo(1, 5);
for (const obj of state.producers) {
if (obj.count >= 0) {
term(
`${obj.title}: ${
obj.count
} | Production per second: ${obj.baseProduction.toFixed(1)} | Cost: ${
obj.cost
}`
);
}
}
state.isProducerListUpdated = true;
};
//handlers.js
export const init = (term) => {
term.clear();
term.hideCursor();
term.grabInput();
term("Welcome to the mining game!");
};
export const updateGold = (term, state) => {
term.moveTo(25, 2);
term.eraseLineAfter();
term.bold.yellow(`${state.gold} `);
state.gold += state.productionRate;
};
export const checkInitCompleted = (term, state) => {
state.isInitCompleted = true;
term.moveTo(0, 1);
term.clear();
term(
"You can purchase producers by clicking the number button (1, 2, 3, ...)"
);
term.moveTo(0, 2);
term("GOLD:");
term.moveTo(0, 3);
term("PRODUCTION RATE:");
state.isProducerListUpdated = false;
};
export const updateProducerList = (term, state) => {
term.moveTo(1, 5);
for (const obj of state.producers) {
if (obj.count >= 0) {
term(
`${obj.title}: ${
obj.count
} | Production per second: ${obj.baseProduction.toFixed(1)} | Cost: ${
obj.cost
}`
);
}
}
state.isProducerListUpdated = true;
};
Добрый день! Не могу понять где здесь ошибка