add leaderboard

This commit is contained in:
biglyderv 2024-11-25 14:14:21 -05:00
parent dc26c4281b
commit dbab510358
9 changed files with 1575 additions and 8 deletions

View file

@ -105,6 +105,8 @@ class Player {
let oldHealth = target.health
let dmg = Math.floor( (dp-0.001) * 10);
target.health += Math.floor( (dp-0.001) * 10);
target.vel.x += (target.pos.x - ent.pos.x) * 0.1;
@ -112,6 +114,8 @@ class Player {
if (target.health <= 0 && oldHealth > 0) {
console.log(`Player ${target.you} died to a player ${ent.you}`);
ent.health -= dmg;
if (ent.health > 100) ent.health = 100;
ent.headCount++;
}
}