slight gameplay changes
This commit is contained in:
parent
9a701d88dc
commit
d764b94f11
2 changed files with 9 additions and 3 deletions
|
@ -38,17 +38,20 @@ class Player extends Entity {
|
||||||
bump() {
|
bump() {
|
||||||
let player = this;
|
let player = this;
|
||||||
|
|
||||||
if (player.ticks < 10) {
|
let f = 1;
|
||||||
|
|
||||||
|
if (player.ticks < 300) {
|
||||||
player.dir = -3 * Math.sign(player.dir);
|
player.dir = -3 * Math.sign(player.dir);
|
||||||
} else {
|
} else {
|
||||||
|
f = 3;
|
||||||
player.dir = -0.005 * Math.sign(player.dir);
|
player.dir = -0.005 * Math.sign(player.dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.vel.x *= 0.9;
|
player.vel.x *= 0.9;
|
||||||
player.vel.y *= 0.9;
|
player.vel.y *= 0.9;
|
||||||
|
|
||||||
player.vel.x += Math.sin(player.rot) * 15;
|
player.vel.x += Math.sin(player.rot) * 15 * f;
|
||||||
player.vel.y -= Math.cos(player.rot) * 15;
|
player.vel.y -= Math.cos(player.rot) * 15 * f;
|
||||||
|
|
||||||
player.ticks = 0;
|
player.ticks = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,9 @@ class Game extends GameBasic {
|
||||||
textArgs = [`PT: ${Math.round(player.headCount)}`, 25, 75];
|
textArgs = [`PT: ${Math.round(player.headCount)}`, 25, 75];
|
||||||
ctx.strokeText(...textArgs);
|
ctx.strokeText(...textArgs);
|
||||||
ctx.fillText(...textArgs);
|
ctx.fillText(...textArgs);
|
||||||
|
textArgs = [`CH: ${Math.round(player.ticks * 100 / 300)}%`, 25, 125];
|
||||||
|
ctx.strokeText(...textArgs);
|
||||||
|
ctx.fillText(...textArgs);
|
||||||
|
|
||||||
if (player.health <= 0 || player.isMenu) {
|
if (player.health <= 0 || player.isMenu) {
|
||||||
this.doMenu();
|
this.doMenu();
|
||||||
|
|
Loading…
Reference in a new issue