add leaderboard
This commit is contained in:
parent
dc26c4281b
commit
dbab510358
9 changed files with 1575 additions and 8 deletions
|
@ -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++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue