2024-09-29 03:55:22 -04:00
|
|
|
import Player from "./player.js";
|
|
|
|
|
2024-09-29 02:27:44 -04:00
|
|
|
class GameBasic {
|
|
|
|
constructor() {
|
2024-10-03 05:16:40 -04:00
|
|
|
let player = new Player(false, true);
|
2024-09-29 02:27:44 -04:00
|
|
|
let entities = [player];
|
|
|
|
|
2024-09-29 04:11:47 -04:00
|
|
|
/*for (let i = 0; i < 50; i++) {
|
2024-09-29 03:16:15 -04:00
|
|
|
entities.push(new Player(false,false))
|
2024-09-29 04:11:47 -04:00
|
|
|
}*/
|
2024-09-29 02:27:44 -04:00
|
|
|
|
|
|
|
this.player = player;
|
|
|
|
this.entities = entities;
|
2024-09-29 21:20:56 -04:00
|
|
|
|
2024-09-29 21:21:55 -04:00
|
|
|
this.width = this.height = 7500;
|
2024-09-29 02:27:44 -04:00
|
|
|
}
|
|
|
|
main() {
|
|
|
|
let { entities } = this;
|
2024-10-04 02:56:58 -04:00
|
|
|
let that = this;
|
2024-09-29 02:27:44 -04:00
|
|
|
|
|
|
|
for (let ent of entities) {
|
2024-10-04 02:56:58 -04:00
|
|
|
(async function() {
|
|
|
|
ent.handleTick(that)
|
|
|
|
})();
|
2024-09-29 02:27:44 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
init() {
|
|
|
|
let that = this;
|
|
|
|
setInterval(function () { that.main() }, 1000 / 60);
|
|
|
|
}
|
2024-09-29 03:55:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export default GameBasic;
|