add death
This commit is contained in:
parent
b6ffe5cf32
commit
b88d04a556
4 changed files with 44 additions and 16 deletions
10
js/player.js
10
js/player.js
|
@ -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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue