mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
fixes enemy stat update
This commit is contained in:
parent
a66a327386
commit
ed35071fff
2 changed files with 11 additions and 4 deletions
|
|
@ -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
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue