mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
added first damage and killing
This commit is contained in:
parent
2a4327c5cf
commit
f22e0dd53d
9 changed files with 124 additions and 52 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue