split up game code using new es5 syntax or whatever

This commit is contained in:
biglyderv 2024-11-25 14:14:20 -05:00
parent b237b857c7
commit 506e6be65d
5 changed files with 93 additions and 82 deletions

24
common/game_basic.js Normal file
View file

@ -0,0 +1,24 @@
class GameBasic {
constructor() {
let player = new Player(true);
let entities = [player];
for (let i = 0; i < 50; i++) {
entities.push(new Player())
}
this.player = player;
this.entities = entities;
}
main() {
let { entities } = this;
for (let ent of entities) {
ent.handleTick(this);
}
}
init() {
let that = this;
setInterval(function () { that.main() }, 1000 / 60);
}
}