diff --git a/js/entities/player.js b/js/entities/player.js index fba5974..7c3dfde 100644 --- a/js/entities/player.js +++ b/js/entities/player.js @@ -8,10 +8,10 @@ function Player(xval, yval, width, height, id) { this.height = height; this.mana = 20; this.maxMana = 20; - this.manaRegen = 1.0; + this.manaRegen = (1/20); this.health = 10; this.maxHealth = 10; - this.healthRegen = 0.0; + this.healthRegen = (1/10); this.inShot = false; this.right = true; this.color = 0xe67e22; @@ -81,8 +81,12 @@ function Player(xval, yval, width, height, id) { } this.regen = function() { - if (this.mana < this.maxMana) this.mana += this.manaRegen; + //Mana + if (this.mana < this.maxMana) this.mana += (this.manaRegen * this.maxMana); if (this.mana > this.maxMana) this.mana = this.maxMana; + //Health + if (this.health < this.maxHealth) this.health += (this.healthRegen * this.maxHealth); + if (this.health > this.maxHealth) this.health = this.maxHealth; } this.levelUp = function() {