refactor: Remove ES6 module syntax and reorder script loading
This commit is contained in:
parent
8057ba881b
commit
a002d4b017
5
ai.js
5
ai.js
@ -6,8 +6,7 @@ const ANIMAL_HUNGER_MAX = 100;
|
||||
/**********************************************************************
|
||||
* CITIZEN AI
|
||||
**********************************************************************/
|
||||
// Export functions
|
||||
export function updateCitizen(cit) {
|
||||
function updateCitizen(cit) {
|
||||
cit.hunger += HUNGER_INCREMENT;
|
||||
if(cit.hunger > HUNGER_MAX) cit.hunger = HUNGER_MAX;
|
||||
|
||||
@ -54,7 +53,7 @@ export function updateCitizen(cit) {
|
||||
/**********************************************************************
|
||||
* ANIMAL AI
|
||||
**********************************************************************/
|
||||
export function updateAnimal(ani) {
|
||||
function updateAnimal(ani) {
|
||||
if(ani.type === "Rabbit") {
|
||||
updateRabbit(ani);
|
||||
}
|
||||
|
3
game.js
3
game.js
@ -1,8 +1,7 @@
|
||||
/**********************************************************************
|
||||
* GAME CORE
|
||||
**********************************************************************/
|
||||
// Import AI functions
|
||||
import { updateCitizen, updateAnimal } from './ai.js';
|
||||
// AI functions are defined in ai.js and loaded via script tag
|
||||
let frameCount = 0;
|
||||
let money = 5000; // Start with 5000
|
||||
let purchaseMode = null;
|
||||
|
@ -207,12 +207,12 @@
|
||||
<div id="log"></div>
|
||||
</div>
|
||||
|
||||
<script src="game.js"></script>
|
||||
<script src="entities.js"></script>
|
||||
<script src="utils.js"></script>
|
||||
<script src="ai.js"></script>
|
||||
<script src="render.js"></script>
|
||||
<script src="events.js"></script>
|
||||
<script src="game.js"></script>
|
||||
|
||||
<script>
|
||||
/**********************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user