change scoring and sorting
This commit is contained in:
parent
5414c719f1
commit
155257514d
4 changed files with 16 additions and 6 deletions
|
@ -100,7 +100,7 @@ class Game extends GameBasic {
|
|||
ctx.textBaseline = "bottom";
|
||||
ctx.font = "bold 16px sans-serif";
|
||||
|
||||
let args = [`HP: ${ent.health} KO: ${ent.headCount} XY: ${Math.round(ent.pos.x)}, ${Math.round(ent.pos.y)}`, ent.pos.x, ent.pos.y - 64 / 2];
|
||||
let args = [`HP: ${ent.health} PT: ${ent.headCount} XY: ${Math.round(ent.pos.x)}, ${Math.round(ent.pos.y)}`, ent.pos.x, ent.pos.y - 64 / 2];
|
||||
|
||||
ctx.strokeText(...args);
|
||||
ctx.fillText(...args);
|
||||
|
@ -259,7 +259,7 @@ class Game extends GameBasic {
|
|||
scores[e.ip] += e.ko ** 2;
|
||||
}
|
||||
|
||||
scores = Object.entries(scores).sort((a,b) => b.ko - a.ko);
|
||||
scores = Object.entries(scores).sort((a,b) => b[1] - a[1]);
|
||||
|
||||
document.querySelector('.lb').textContent = scores.map(x => `${x[0]}: ${x[1]}`).join('\n');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue