mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
replaced killed doll with ragdoll - fixes #50
This commit is contained in:
parent
aa6fdaa2df
commit
413254bfa4
19 changed files with 330 additions and 88 deletions
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue