Compare commits
3 commits
3c47694f3d
...
36f342a47d
Author | SHA1 | Date | |
---|---|---|---|
|
36f342a47d | ||
|
79622b5bfe | ||
|
d075d532d7 |
3 changed files with 18 additions and 8 deletions
|
@ -41,6 +41,12 @@ class Player
|
|||
this.death++;
|
||||
this.health=defaulthealth;
|
||||
|
||||
players.forEach((p) => {
|
||||
if(p.id==killerId) {
|
||||
p.kill++;
|
||||
}
|
||||
});
|
||||
|
||||
net.died(this.id,killerId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,10 +98,11 @@ function updatePlayer(data)
|
|||
{
|
||||
player.x=data.x;
|
||||
player.y=data.y;
|
||||
if(data.z==undefined)
|
||||
if(data.z==undefined){
|
||||
player.z=0;
|
||||
else
|
||||
} else {
|
||||
player.z=data.z;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -111,10 +112,11 @@ function updatePlayer(data)
|
|||
{
|
||||
players[i].x=data.x;
|
||||
players[i].y=data.y;
|
||||
if(data.z==undefined)
|
||||
if(data.z==undefined){
|
||||
players[i].z=0;
|
||||
else
|
||||
} else {
|
||||
players[i].z=data.z;
|
||||
}
|
||||
players[i].dir=data.dir;
|
||||
players[i].visibleDir=data.visibleDir;
|
||||
break;
|
||||
|
@ -150,10 +152,12 @@ function addKill(idKilled,idKiller)
|
|||
player.death++;
|
||||
}
|
||||
players.forEach((p) => {
|
||||
if(p.id==idKilled)
|
||||
if(p.id==idKilled) {
|
||||
p.death++;
|
||||
if(p.id==idKiller)
|
||||
}
|
||||
if(p.id==idKiller) {
|
||||
p.kill++;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -52,8 +52,8 @@ class LeaderBoard {
|
|||
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.kill, this.px+180, this.py+120+20*this.nbjoueur);
|
||||
this.ctx.fillText(p.death, this.px+200, 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.ctx.fillText(p.id>0 ? 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.nbjoueur++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue