bouncy edges, crit hits

This commit is contained in:
biglyderv 2024-10-04 10:56:17 -04:00
parent 37dc747033
commit 3ed203b662
No known key found for this signature in database
GPG key ID: 33AC87E9ACE66954

View file

@ -67,6 +67,14 @@ class Player {
ent.pos.x = Math.max(Math.min(ent.pos.x, width / 2), - width / 2); 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); 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.x *= 0.9;
ent.vel.y *= 0.9; ent.vel.y *= 0.9;
@ -97,7 +105,10 @@ class Player {
} }
if (target.immortal) continue; 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) { if (target.health == 0) {
ent.headCount++; ent.headCount++;