Compare commits

..

No commits in common. "36f342a47d2a03eec3482e70ccf9674f97417901" and "3c47694f3db753a5ac296d20a5624cec5d085b46" have entirely different histories.

3 changed files with 8 additions and 18 deletions

View file

@ -41,12 +41,6 @@ class Player
this.death++; this.death++;
this.health=defaulthealth; this.health=defaulthealth;
players.forEach((p) => {
if(p.id==killerId) {
p.kill++;
}
});
net.died(this.id,killerId); net.died(this.id,killerId);
} }
} }

View file

@ -98,11 +98,10 @@ function updatePlayer(data)
{ {
player.x=data.x; player.x=data.x;
player.y=data.y; player.y=data.y;
if(data.z==undefined){ if(data.z==undefined)
player.z=0; player.z=0;
} else { else
player.z=data.z; player.z=data.z;
}
} }
else else
{ {
@ -112,11 +111,10 @@ function updatePlayer(data)
{ {
players[i].x=data.x; players[i].x=data.x;
players[i].y=data.y; players[i].y=data.y;
if(data.z==undefined){ if(data.z==undefined)
players[i].z=0; players[i].z=0;
} else { else
players[i].z=data.z; players[i].z=data.z;
}
players[i].dir=data.dir; players[i].dir=data.dir;
players[i].visibleDir=data.visibleDir; players[i].visibleDir=data.visibleDir;
break; break;
@ -152,12 +150,10 @@ function addKill(idKilled,idKiller)
player.death++; player.death++;
} }
players.forEach((p) => { players.forEach((p) => {
if(p.id==idKilled) { if(p.id==idKilled)
p.death++; p.death++;
} if(p.id==idKiller)
if(p.id==idKiller) {
p.kill++; p.kill++;
}
}); });
} }

View file

@ -52,8 +52,8 @@ class LeaderBoard {
this.ctx.fillText((this.nbjoueur+1), this.px+10, this.py+120+20*this.nbjoueur); this.ctx.fillText((this.nbjoueur+1), this.px+10, this.py+120+20*this.nbjoueur);
this.ctx.fillText(p.name, this.px+30, this.py+120+20*this.nbjoueur); this.ctx.fillText(p.name, this.px+30, this.py+120+20*this.nbjoueur);
this.ctx.fillText(p.kill, this.px+180, this.py+120+20*this.nbjoueur); this.ctx.fillText(p.kill, this.px+180, this.py+120+20*this.nbjoueur);
this.ctx.fillText(p.id>0 ? p.death : "-", this.px+200, this.py+120+20*this.nbjoueur); this.ctx.fillText(p.death, this.px+200, this.py+120+20*this.nbjoueur);
this.ctx.fillText(p.id>0 ? Math.round(10*p.kill/p.death)/10 : "-", this.px+220, this.py+120+20*this.nbjoueur); this.ctx.fillText(Math.round(10*p.kill/p.death)/10, this.px+220, this.py+120+20*this.nbjoueur);
this.nbjoueur++; this.nbjoueur++;
} }