fixes enemy stat update

This commit is contained in:
Jeena 2015-04-19 18:13:53 +02:00
parent a66a327386
commit ed35071fff
2 changed files with 11 additions and 4 deletions

View file

@ -70,7 +70,7 @@ function (Parent, Nc) {
this.kill(enemy, byItem);
}
this.broadcastStats();
this.broadcastStats(enemy);
};
Player.prototype.spawn = function(x, y) {
@ -102,11 +102,18 @@ function (Parent, Nc) {
this.stats.score++;
};
Player.prototype.broadcastStats = function() {
Player.prototype.broadcastStats = function(enemy) {
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, "updateStats", {
playerId: this.id,
stats: this.stats
});
if(enemy && enemy != this) {
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, "updateStats", {
playerId: enemy.id,
stats: enemy.stats
});
}
};