expanding map
This commit is contained in:
parent
4602947942
commit
e584361465
5 changed files with 27 additions and 10 deletions
9
game.js
9
game.js
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue