add death

This commit is contained in:
biglyderv 2024-11-25 14:14:20 -05:00
parent b6ffe5cf32
commit b88d04a556
4 changed files with 44 additions and 16 deletions

View file

@ -9,6 +9,8 @@ function Player() {
this.rot = 0;
this.dir = 1;
this.ticks = 0;
this.health = 100;
}
Player.prototype.bump = function () {
@ -18,11 +20,11 @@ Player.prototype.bump = function () {
player.dir *= -1;
}
player.vel.x *= 0.6;
player.vel.y *= 0.6;
player.vel.x *= 0.9;
player.vel.y *= 0.9;
player.vel.x += Math.sin(player.rot) * 25;
player.vel.y -= Math.cos(player.rot) * 25;
player.vel.x += Math.sin(player.rot) * 8;
player.vel.y -= Math.cos(player.rot) * 8;
player.ticks = 0;
}