expanding map

This commit is contained in:
biglyderv 2024-11-25 14:14:20 -05:00
parent 4602947942
commit e584361465
5 changed files with 27 additions and 10 deletions

View file

@ -7,6 +7,13 @@ class Game extends GameBasic {
this.ws = [];
}
sync(full = false) {
let onScreen = this.entities.filter(x => x && x.health > 0).length;
onScreen += 4;
this.width = (this.width * 0.99) + (Math.sqrt(onScreen) * 16);
this.height = (this.height * 0.99) + (Math.sqrt(onScreen) * 16);
let { entities } = this;
let entList = [];
for (let entity of entities) {
@ -40,6 +47,8 @@ class Game extends GameBasic {
return props.map(prop => x[prop]);
});
filtered.push([this.width,this.height])
client.send(JSON.stringify(filtered));
wsEnt.isYou = false;