diff --git a/common/player.js b/common/player.js index 6db06ce..d8df448 100644 --- a/common/player.js +++ b/common/player.js @@ -67,6 +67,14 @@ class Player { ent.pos.x = Math.max(Math.min(ent.pos.x, width / 2), - width / 2); ent.pos.y = Math.max(Math.min(ent.pos.y, height / 2), - height / 2); + if (Math.abs(ent.pos.x) >= width / 2 ) { + ent.vel.x = (Math.abs(ent.vel.x) + 10) * -Math.sign(ent.pos.x); + } + + if (Math.abs(ent.pos.y) >= height / 2) { + ent.vel.y = (Math.abs(ent.vel.y) + 10) * -Math.sign(ent.pos.y); + } + ent.vel.x *= 0.9; ent.vel.y *= 0.9; @@ -97,7 +105,10 @@ class Player { } if (target.immortal) continue; - target.health--; + target.health += Math.floor( (dp-0.001) * 10); + + target.vel.x += (target.pos.x - ent.pos.x) * 0.1; + target.vel.y += (target.pos.y - ent.pos.y) * 0.1; if (target.health == 0) { ent.headCount++;