unibutton/common/game_basic.js

33 lines
No EOL
714 B
JavaScript

import Player from "./player.js";
class GameBasic {
constructor() {
let player = new Player(false, true);
let entities = [player];
/*for (let i = 0; i < 50; i++) {
entities.push(new Player(false,false))
}*/
this.player = player;
this.entities = entities;
this.width = this.height = 7500;
}
main() {
let { entities } = this;
let that = this;
for (let ent of entities) {
(async function() {
ent.handleTick(that)
})();
}
}
init() {
let that = this;
setInterval(function () { that.main() }, 1000 / 60);
}
}
export default GameBasic;