refactor: Resolve import and constant duplication issues in AI and game modules
This commit is contained in:
10
game.js
10
game.js
@@ -1,6 +1,8 @@
|
||||
/**********************************************************************
|
||||
* GAME CORE
|
||||
**********************************************************************/
|
||||
// Import AI functions
|
||||
import { updateCitizen, updateAnimal } from './ai.js';
|
||||
let frameCount = 0;
|
||||
let money = 5000; // Start with 5000
|
||||
let purchaseMode = null;
|
||||
@@ -122,7 +124,13 @@ function update() {
|
||||
frameCount++;
|
||||
|
||||
// Citizens
|
||||
citizens.forEach((cit) => updateCitizen(cit));
|
||||
citizens.forEach((cit) => {
|
||||
if(typeof updateCitizen === 'function') {
|
||||
updateCitizen(cit);
|
||||
} else {
|
||||
console.error("updateCitizen function is not defined!");
|
||||
}
|
||||
});
|
||||
|
||||
// Animals
|
||||
animals.forEach((ani) => {
|
||||
|
||||
Reference in New Issue
Block a user