replaced killed doll with ragdoll - fixes #50

This commit is contained in:
logsol 2014-02-18 01:15:24 +01:00
parent aa6fdaa2df
commit 413254bfa4
19 changed files with 330 additions and 88 deletions

View file

@ -56,13 +56,17 @@ function (Parent, NotificationCenter) {
}
};
Player.prototype.suicide = function() {
this.addDamage(100, this);
};
Player.prototype.addDamage = function(damage, enemy) {
this.stats.health -= damage;
if(this.stats.health < 0) this.stats.health = 0;
if(this.stats.health <= 0) {
enemy.score();
if(enemy != this) enemy.score();
this.kill(enemy);
} else {
this.broadcastStats();
@ -83,6 +87,10 @@ function (Parent, NotificationCenter) {
playerId: this.id,
killedByPlayerId: killedByPlayer.id
});
if(this.ragDoll) {
this.ragDoll.delayedDestroy();
}
};
Player.prototype.score = function() {