added first damage and killing

This commit is contained in:
Jeena 2014-01-21 03:14:50 +01:00
parent 2a4327c5cf
commit f22e0dd53d
9 changed files with 124 additions and 52 deletions

View file

@ -58,6 +58,15 @@ function (Parent, NotificationCenter) {
}
}
};
Player.prototype.addDamage = function(damage, enemy) {
this.stats.health -= damage;
if(this.stats.health <= 0) {
this.stats.deaths++;
enemy.stats.kills++;
this.kill();
}
};
return Player;