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
|
* CITIZEN AI
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
// Export functions
|
function updateCitizen(cit) {
|
||||||
export function updateCitizen(cit) {
|
|
||||||
cit.hunger += HUNGER_INCREMENT;
|
cit.hunger += HUNGER_INCREMENT;
|
||||||
if(cit.hunger > HUNGER_MAX) cit.hunger = HUNGER_MAX;
|
if(cit.hunger > HUNGER_MAX) cit.hunger = HUNGER_MAX;
|
||||||
|
|
||||||
@ -54,7 +53,7 @@ export function updateCitizen(cit) {
|
|||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* ANIMAL AI
|
* ANIMAL AI
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
export function updateAnimal(ani) {
|
function updateAnimal(ani) {
|
||||||
if(ani.type === "Rabbit") {
|
if(ani.type === "Rabbit") {
|
||||||
updateRabbit(ani);
|
updateRabbit(ani);
|
||||||
}
|
}
|
||||||
|
3
game.js
3
game.js
@ -1,8 +1,7 @@
|
|||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* GAME CORE
|
* GAME CORE
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
// Import AI functions
|
// AI functions are defined in ai.js and loaded via script tag
|
||||||
import { updateCitizen, updateAnimal } from './ai.js';
|
|
||||||
let frameCount = 0;
|
let frameCount = 0;
|
||||||
let money = 5000; // Start with 5000
|
let money = 5000; // Start with 5000
|
||||||
let purchaseMode = null;
|
let purchaseMode = null;
|
||||||
|
@ -207,12 +207,12 @@
|
|||||||
<div id="log"></div>
|
<div id="log"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="game.js"></script>
|
|
||||||
<script src="entities.js"></script>
|
<script src="entities.js"></script>
|
||||||
<script src="utils.js"></script>
|
<script src="utils.js"></script>
|
||||||
<script src="ai.js"></script>
|
<script src="ai.js"></script>
|
||||||
<script src="render.js"></script>
|
<script src="render.js"></script>
|
||||||
<script src="events.js"></script>
|
<script src="events.js"></script>
|
||||||
|
<script src="game.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user